<template>
  <!-- 训练营详情 -->
  <div :class="{'theme-market': showMarketingBar}">
    <div v-if="campDetail != ''">
      <div class="c-w100 c-maxh427 c-text-hidden c-p">
        <img class="c-w100 imgCloseBig" :src="$addXossFilter(campDetail.cover, require('@/assets/defult_head.png'))" alt="">
      </div>
      <!-- 营销活动倒计时.无拼团 -->
      <flash-sales-time-new v-if="showMarketingBar"
        :type="campDetail.sales? 'isSale':campDetail.isFriendHelper ? 'isFa' : campDetail.bargain ? 'isBargain' : 'isCollage'"
        :price="campDetail.sales ? campDetail.sales.price : campDetail.collage ? campDetail.collage.captainPrice : campDetail.bargain ? campDetail.bargain.reservePrice : ''"
        :from="campDetail.collage && campDetail.collage.collageGroupType && campDetail.collage.collageGroupType == 2 ? 'activity' : ''"
        :startTime="campDetail.sales ? campDetail.sales.sales.startTime : campDetail.bargain ? campDetail.bargain.startTime : campDetail.collage ? campDetail.collage.startTime : campDetail.faStartAt"
        :endTime="campDetail.sales ? campDetail.sales.sales.endTime : campDetail.bargain ? campDetail.bargain.endTime : campDetail.collage ? campDetail.collage.endTime : campDetail.faEndAt"
        :originalPrice="campDetail.price"
        :stock="campDetail.sales ? campDetail.sales.balance: ''"
        :stockBargain="campDetail.bargain && campDetail.bargain.stock"
        :isLimit="campDetail.sales && campDetail.sales.limit == 0 || (campDetail.bargain && campDetail.bargain.isLimitStock == 2) ? false : true"
        :salesTag="campDetail.sales && campDetail.sales.sales.tags"
        :peopleNum="campDetail.collage && campDetail.collage.peopleNum"
        :isPreheat="campDetail.bargain && campDetail.bargain.isPreheat"
        :bargainStatus="campDetail.bargain && campDetail.bargain.status"
        :optimal="optimal"
        @showCoupon="showCoupon = true"
        @falshSalesTime="falshSalesTime"
        @finishFlashSales="finishFlashSales"
      >
      </flash-sales-time-new>
      <section>
        <div class="c-bd-b12-f5 c-mt24 c-pb24 c-p">
          <price-bar v-if="!isMarketing && !campDetail.hasPermission && !(campDetail.sales || campDetail.isFriendHelper || (campDetail.collage && (campDetail.collage.status == 1 || campDetail.collage.status == 2)))"
            :recType="recType"
            :dataInfo="campDetail"
            :styleType="2"
            :chainInfo="chainInfo"
          >
          </price-bar>
          <div class="theme-bg-10 c-br8 c-mt4 c-pv10 c-ph10 c-flex-row c-mh24" v-if="campDetail.payType == 4 && !isRecommend">
            <div class="c-flex-row c-aligni-center c-fs20 c-fc-white theme-bg-gradient c-br8 c-ph10 c-pv4" @click="clickGoRules">
              <div class="iconfont c-fc-white c-fs32 c-mr4">&#xe746;</div>
              奖学金模式
              <div class="iconfont c-fc-white c-fs32 c-ml4">&#xe669;</div>
            </div>
            <div class="c-fs20 theme-fc c-ml10 c-pt8">
              努力学习，赢奖金平分
            </div>
          </div>
          <discount-info class="c-mt8" v-if="!isiOS && !campDetail.hasPermission && campDetail.isSaleOnly != 0 && campDetail.payType == 2 && !isRecommend"
            :couponList="couponList"
            :dataInfo="campDetail"
            :chainInfo="chainInfo"
            :isMarketing="isMarketing"
            @clickShowCoupon="showCoupon = true"
          >
          </discount-info>
          <div class="c-ph24 c-mt20" v-if="((!isChainProd && !optimal )|| optimal) && campDetail.payType != 4 && !isRecommend && !campDetail.hasPermission && !$isWxAppIos() && !isiOS">
            <vip-entry
              :styleType="2"
              :dataInfo="campDetail"
            ></vip-entry>
          </div>
          <div v-if="!isRecommend || (isRecommend && campDetail.hasPermission)" class="c-ph24 c-mt24">
            <div class="c-fs30 c-fc-xblack c-fw600">{{campDetail.name}}</div>
          </div>
          <div class="c-flex-row c-aligni-center c-ph24 c-mt24">
            <div class="c-w0 c-flex-grow1">
              <div class="c-fc-xblack c-fs20 c-pb12" v-if="campDetail.joinMode == 1">上课时间：{{campDetail.startAt}}至{{campDetail.endAt}}</div>
              <div class="c-fs20 c-fc-gray c-flex-row c-aligni-center c-flexw-wrap">
                <div class="c-mr20 c-pv4"><span class="c-fs20 iconfont c-mr4">&#xe69c;</span>共{{campDetail.partCount}}节</div>
                <div class="c-mr20" v-if="enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(ckfrom.camp))"><span class="c-fs20 iconfont c-mr4 c-pv4">&#xe647;</span>{{signUpPeople}}人报名</div>
                <div class="c-flex-row c-aligni-center c-pv4">
                  <span class="c-fs20 iconfont c-mr4">&#xe7a6;</span>
                  <valid-time-com :dataInfo="campDetail" :prodId="campId" :prodType="78"></valid-time-com>
                </div>
              </div>
            </div>
            <div class="c-flex-row c-aligni-center">
              <div v-if="campDetail.showPresentFriend && !isiOS && !$isWxApp()" class="c-flex-column c-aligni-center c-ww52 c-mr8 coms-live-iframe-none" @click="popPresentCamp">
                <div class="iconfont c-fs36 c-fc-xblack">&#xe7b9;</div>
                <div class="c-fs16 c-fc-xblack c-mt4">赠送</div>
              </div>
            </div>
          </div>
          <div v-if="isCertificate" @click="handleClickCertificate()" class="c-hh48 c-mh24 c-ph20 c-flex-row c-aligni-center cer-bg c-br8 c-mt30">
            <div class="c-flex-row c-aligni-center c-w0 c-flex-grow1">
              <div class="iconfont c-fs24 c-fc-myellow">&#xe724;</div>
              <div class="c-fs20 c-fc-myellow c-ml10">恭喜您获得毕业证书</div>
            </div>
            <div class="c-hh20 c-ww20 c-br20 c-flex-row c-flex-center c-lh c-fc-white c-bg-right"><span class="iconfont c-fs12">&#xe60e;</span></div>
          </div>
          <!-- 引导入群 -->
          <invite-group class="c-pr24 c-mt30"
            v-if="isShowGuide"
            :guideText="'进入课程交流群'"
            @handleShowGuidePop="handleShowGuidePop"
          >
          </invite-group>
        </div>
        <!-- 积分及会员，大转盘，vip入口优惠提示 -->
        <div class="c-ph24 c-bd-b12-f5" v-if="(campDetail.giftRelates && campDetail.giftRelates.length > 0) || (campDetail.circleList && campDetail.circleList.length > 0) || (!campDetail.hasPermission && campDetail.centerProducts && campDetail.centerProducts.length > 0 && campDetail.centerProducts[0]) || (relateCollocation && relateCollocation.length > 0) || showTurn">
          <discount-tip
            :styleType="2"
            :relateCollocationArr="relateCollocation"
            :hasGiftRelates="campDetail.giftRelates && campDetail.giftRelates.length > 0 ? true : false"
            :giftRelatesCount="campDetail.giftRelates ? campDetail.giftRelates.length : 0"
            :hasCircle="campDetail && campDetail.circleList && campDetail.circleList.length > 0"
            @goTOturn="goTOturn"
            @joinCircle="joinCircle"
            @popGiftModal="popGiftModal"
            @goCenterProduct="goCenterProduct"
            :turnName="campDetail.joinActivityInfo && campDetail.joinActivityInfo.activityData?campDetail.joinActivityInfo.activityData.name:''"
            :showTurn="showTurn"
            :recommendProdInfo="!campDetail.hasPermission && campDetail.centerProducts && campDetail.centerProducts.length > 0 && campDetail.centerProducts[0] ? campDetail.centerProducts[0] : null"
            :chainInfo="chainInfo"
          ></discount-tip>
        </div>
        <bargain-rules class="c-bd-b12-f5" v-if="campDetail.bargain != null && !campDetail.hasPermission" :isPreheat="campDetail.bargain.isPreheat" :status="campDetail.bargain.status"></bargain-rules>

        <formEntry v-if="campDetail.hasPermission && (!campDetail.isTeacher&&((campDetail.collectPage==3&& campDetail.isRelForm == true && campDetail.hasFormLog == false && isShowFormlg)||(campDetail.hasFormLog&&campDetail.enableEdit==2&& isShowFormlg&& campDetail.isRelForm == true)))"
          relType="6"  :relId="campId"   :dataInfo="campDetail"
          classObject="c-fs24 c-fw600" fontSizeClass="c-fs24" iconSizeClass="c-fs18" topClass="c-bd-b12-f5"
          @goForm="goForm" ></formEntry>
        <collage-persons-list class="c-p c-bd-b12-f5" v-if="campDetail && !campDetail.hasPermission && !campDetail.isEnroll && campDetail.collage && (campDetail.collage.status == 2 || campDetail.collage.status == 1)" :isCourse="true" :collage="campDetail.collage" @startCollage="goCollageDetail(-1,campDetail.collage.collageId)" @goCollageDetail="gcd"></collage-persons-list>
        <more-device v-if="campDetail.hasPermission && typeBar == 0" class="c-bd-b12-f5" :positionType="moreDeviceType" :prodInfo="{prodType: ckfrom.camp, prodId: campId}"></more-device>
      </section>
      <section id="divider" class="minh76">
        <my-small-tabbar id="tabhBar" class="c-bg-white c-hh76 c-bd-b1-f6 c-ph24" :styleType="2" :tabList="tabList" :tabIndex="typeBar" @changeTab="changeType" :class="tabhBarFixed == true ? ($isWxApp() || !showNavBar ? 'tabhBar c-wx-top0' : 'tabhBar') : ''"></my-small-tabbar>
        <!-- 训练营详情 -->
        <div class="c-pb20 c-minh312" v-show="typeBar == 0">
          <div class="c-pv28 c-flex-row c-ph24 c-aligni-center c-justify-sb" v-if="campDetail.nickname != null">
            <div class="c-flex-row">
              <img :src="$addXossFilter(campDetail.headimgurl, require('../../../assets/defult_head.png'))" class="c-ww100 c-hh100 c-brp50 c-block" />
              <div class="c-flex-column c-ml24">
                <span class="c-fs28 c-fc-xblack c-mt10">{{campDetail.nickname}}</span>
              </div>
            </div>
          </div>
          <course-description
            class="c-ph24"
            ref="descriptions"
            :independentCopy="cfg.isCopy"
            :independentCopyPicture="cfg.isCopyPicture"
            :prodType="cfrom.camp"
            :prodId="campId"
          ></course-description>
          <commentCom ref="detailCommentCom" v-if="isShowComments('detail')" positionType="detail" :prodType="cfrom.camp" :prodId="campId" :bindPhoneSetting="bindPhoneSetting" @getCommentCount="getCommentCount" @addCommentSuccess="addCommentSuccess"></commentCom>
        </div>

        <!-- 训练营目录 -->
        <div class="c-p c-minh640" v-show="typeBar == 1">
          <!-- 获取权限后查看完整内容 -->
          <div v-if="campDetail.showListBeforeBuy == 0 && !campDetail.hasPermission && catalog.length > 0" class="c-pa c-w100 c-h c-flex-column c-flex-center c-fs24 c-fc-xblack c-pz1">
            <i class="iconfont c-fs36 theme-fc">&#xe615;</i>
            <div class="c-mt14">获取权限后查看完整目录内容</div>
          </div>
          <div class="c-pt40" :class="campDetail.showListBeforeBuy == 0 && !campDetail.hasPermission ? 'cata-cover' : ''">
            <div class="c-ph24" v-if="catalog.length != 0" v-for="(item,index) in catalog" :key="index">
              <div class="c-flex-row c-justify-sb c-aligni-start c-fs26 c-mb40" @click="foldAndUnfold(index,item)">
                <div class="c-w0 c-flex-grow1 c-text-ellipsis1">
                  <span class="c-mr10 c-fc-xblack c-fw600">{{index < 9 ? '0' +(index+1) : (index+1)}}</span>
                  <span class=" c-fc-xblack c-fw600">{{item.name}}</span>
                </div>
                <div class="c-flex-shrink0">
                  <span v-if="item.date && !(campDetail.modeType == 1 && campDetail.dateLockType == 2) " class="c-fs20 c-fc-gray">{{item.date}}</span>
                  <span v-show="isShowDirDetail == 0 && item.lessons.length>0" class="iconfont c-fs18 c-ml10 c-fc-gray">{{showDetail === index ? '&#xe6ab;' : '&#xe6a9;'}}</span>
                </div>
              </div>
              <template v-if="lesson != [] && isShowDirDetail == 1">
                <div class="c-flex-row c-justify-sb c-aligni-center c-pl40 c-p" v-for="(lesson,lessIndex) in item.lessons" :key="lessIndex" @click="clickLessonDetail(lesson,catalog[index].isLock,catalog[index].id,lessIndex,index)">
                  <div class="c-w100 c-fs24  c-flex-row c-aligni-start c-p">
                    <!-- relType 5课程 8资料 51直播 41打卡 11考试 76表单 77AI测评 -->
                    <span class="theme-bd1 c-fs16 c-br20 c-ph10 c-hh32 c-lh32 theme-fc c-mr10 c-ws-n c-flex-row c-flex-center">{{lesson.relType == 5 && lesson.parentType == 0 ? "视频" : lesson.relType == 5 && lesson.parentType == 1 ? "音频" : lesson.relType == 5 && lesson.parentType == 2 ? "图文" : lesson.relType == 202 ? "作业" : lesson.relType == 8 ? "资料" : lesson.relType == 51 ? "直播" : lesson.relType == 41 ? "打卡" : lesson.relType == 11 ? "测评": lesson.relType == 75 ? "互动测评" : lesson.relType == 76 ? "表单" : lesson.relType == 77 ? "AI测评": lesson.relType == 125 ? "考试" : lesson.relType == 129 ? "练习" : lesson.relType == 142 ? "电子书" : lesson.relType == 780 ? (lesson.parentType == 0 ? "视频":lesson.parentType == 1?"音频":"图文") : ""}}</span>
                    <div class="c-fc-xblack c-pb20 c-flex-grow1">
                      <div class="c-flex-grow1 c-flex-row c-justify-sb c-aligni-start">
                        <div class="c-flex-grow1 c-flex-row c-aligni-start">
                          <span class="c-w0 c-flex-grow1 c-text-ellipsis1">{{lesson.relName}}</span>
                          <span id="scrollToLearn" v-if="!catalog[index].isLock && !lesson.isLock && learningPosition != null && learningPosition.innerIndex == lessIndex && learningPosition.outIndex == index" class="c-fs16 c-lh22 c-fc-white theme-bg c-ph6 c-pv2 c-ml20 c-ws-n">上次学到</span>
                        </div>
                        <span class="c-pl16 c-textAlign-c c-block theme-fc c-fs20 c-ws-n" v-if="!campDetail.isEnroll && lesson.isFree == 1">{{(lesson.parentType == 1 && lesson.relType == 5 || lesson.relType == 780 && lesson.parentType == 1) ? '可试听' : '可试看'}}</span>
                        <template v-if="campDetail.modeType == 3">
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else-if="campDetail.modeType == 4">
                          <div class="c-fs20 c-fc-gray c-ph10" v-if="lesson.startAt && lesson.endAt">{{lesson.startAt}}~{{lesson.endAt}}</div>
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else-if="campDetail.modeType == 1 && campDetail.dateLockType ==2">
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else>
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="catalog[index].isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                      </div>
                      <div class="c-flex-row c-aligni-center c-mt20">
                        <span class="c-fs18 c-ph8 c-pv2 c-lh-n theme-bg-10 c-fc-white c-br4 c-mr8 c-p c-vcAlign-middle c-mr10" v-if="lesson.enableDayPractice==1">
                          <span class="theme-fc c-fs18">每日一练</span>
                          <span class="c-pa prodType-triangle"></span>
                        </span>
                        <!-- 日期模式自定义时间特殊处理，小结解锁 modeType = 1 且 dateLockType = 2 -->
                        <template v-if="campDetail.modeType == 1 && campDetail.dateLockType == 2 && campDetail.isEnroll">
                          <div class="c-flex-grow1 c-flex-row c-justify-sb c-aligni-start">
                            <div v-if="!lesson.isLock && lesson.ratio != 0 && campDetail.hasPermission" class="c-fc-gray c-fs18">已完成{{lesson.ratio}}%</div>
                            <div v-if="(lesson.isLock && campDetail.hasPermission) || campDetail.isTeacher" class="c-fc-gray c-fs18">{{ lesson.lockTime.substr(0,16) }} 解锁</div>
                          </div>
                        </template>
                        <template v-else-if="campDetail.isEnroll && !lesson.isLock && lesson.relType == ckfrom.testpPaper && lesson.notReachedButton == true">
                          <div class="c-fs20 c-ph10 theme-fc c-hh24 theme-bg-10 c-flex-row c-flex-center c-br4 c-mr20" @click.stop="handleClickStandard(lesson)">未达标
                            <i class="iconfont c-fs18 c-ml4">&#xe963;</i>
                          </div>
                          <div class="c-fc-gray c-fs18" v-if="!catalog[index].isLock">已完成{{lesson.ratio}}%</div>
                        </template>
                        <template v-else-if="campDetail.isEnroll && !lesson.isLock">
                          <div class="c-fc-gray c-mt28 c-fs18" v-if="!catalog[index].isLock && lesson.ratio != 0 && campDetail.hasPermission">已完成{{lesson.ratio}}%</div>
                        </template>
                      </div>
                    </div>
                  </div>
                  <wxOpenWeapp class="c-w100 c-h c-opacity0 pa-im c-pz10" :appId="'wx0d7934cc4cdcdd64'" :path="wxappPath" :pathQuety="wxappQuery" v-if="isShowWxLiveApp(lesson)">
                    <div class="c-w100 c-h">小程序直播跳转</div>
                  </wxOpenWeapp>
                </div>
              </template>
              <template v-else-if="lesson != [] && isShowDirDetail == 0 && showDetail == index">
                <div class="c-flex-row c-justify-sb c-aligni-center c-pl40 c-p" v-for="(lesson,lessIndex) in item.lessons" :key="lessIndex" @click="clickLessonDetail(lesson,catalog[index].isLock,catalog[index].id,lessIndex,index)">
                  <div class="c-w100 c-fs24  c-flex-row c-aligni-start c-p">
                    <!-- relType 5课程 8资料 51直播 41打卡 11考试 76表单 77AI测评 -->
                    <span class="theme-bd1 c-fs16 c-br8 c-ph8 c-hh32 c-lh32 c-flex-row c-flex-center theme-fc c-mr10 c-ws-n">{{lesson.relType == 5 && lesson.parentType == 0 ? "视频" : lesson.relType == 5 && lesson.parentType == 1 ? "音频" : lesson.relType == 5 && lesson.parentType == 2 ? "图文": lesson.relType == 202 ? "作业" : lesson.relType == 8 ? "资料" : lesson.relType == 51 ? "直播" : lesson.relType == 41 ? "打卡" : lesson.relType == 11 ? "测评" : lesson.relType == 76 ? "表单" : lesson.relType == 77 ? "AI测评": lesson.relType == 75 ? "互动测评": lesson.relType == 125 ? "考试": lesson.relType == 129 ? "练习" : lesson.relType == 142 ? "电子书" : lesson.relType == 780 ? (lesson.parentType == 0 ? "视频":lesson.parentType == 1 ?"音频":"图文") : ""}}</span>
                    <div class="c-fc-xblack c-pb20 c-flex-grow1">
                      <div class="c-flex-grow1 c-flex-row c-justify-sb c-aligni-start">
                        <div class="c-flex-grow1 c-flex-row c-aligni-start">
                          <span class="c-w0 c-flex-grow1 c-text-ellipsis1">{{lesson.relName}}</span>
                          <span id="scrollToLearn" v-if="!catalog[index].isLock && !lesson.isLock && learningPosition != null && learningPosition.innerIndex == lessIndex && learningPosition.outIndex == index" class="c-fs16 c-lh22 c-fc-white theme-bg c-ph6 c-pv2 c-ml20 c-ws-n">上次学到</span>
                        </div>
                        <span class="c-pl16 c-textAlign-c c-block theme-fc c-fs20 c-ws-n" v-if="!campDetail.isEnroll && lesson.isFree == 1">{{(lesson.parentType == 1 && lesson.relType == 5 || lesson.relType == 780 && lesson.parentType == 1) ? '可试听' : '可试看'}}</span>
                        <template v-if="campDetail.modeType == 3">
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else-if="campDetail.modeType == 4">
                          <div class="c-fs20 c-fc-gray c-ph10" v-if="lesson.startAt && lesson.endAt">{{lesson.startAt}}~{{lesson.endAt}}</div>
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else-if="campDetail.modeType == 1 && campDetail.dateLockType ==2">
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="lesson.isLock && campDetail.isEnroll"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                        <template v-else>
                          <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sblack" v-if="catalog[index].isLock && campDetail.isEnroll && !campDetail.isTeacher"><span class="iconfont">&#xe7a5;</span></div>
                        </template>
                      </div>
                      <div class="c-flex-row c-aligni-center c-mt20">
                        <span class="c-fs18 c-ph8 c-pv2 c-lh-n theme-bg-10 c-fc-white c-br4 c-mr8 c-p c-vcAlign-middle c-mr10" v-if="lesson.enableDayPractice==1">
                          <span class="theme-fc c-fs18">每日一练</span>
                          <span class="c-pa prodType-triangle"></span>
                        </span>
                        <!-- 日期模式自定义时间特殊处理，小结解锁 modeType = 1 且 dateLockType = 2 -->
                        <template v-if="campDetail.modeType == 1 && campDetail.dateLockType == 2 && campDetail.isEnroll">
                          <div class="c-flex-grow1 c-flex-row c-justify-sb c-aligni-start">
                            <div v-if="!lesson.isLock && lesson.ratio != 0 && campDetail.hasPermission" class="c-fc-gray c-fs18">已完成{{lesson.ratio}}%</div>
                            <div v-if="lesson.isLock && campDetail.hasPermission" class="c-fc-gray c-fs18">{{ lesson.lockTime.substr(0,16) }} 解锁</div>
                          </div>
                        </template>
                        <template v-else-if="campDetail.isEnroll && !lesson.isLock && lesson.relType == ckfrom.testpPaper && lesson.notReachedButton == true">
                          <div class="c-fs20 c-ph10 theme-fc c-hh24 theme-bg-10 c-flex-row c-flex-center c-br4 c-mr20" @click.stop="handleClickStandard(lesson)">未达标
                            <i class="iconfont c-fs18 c-ml4">&#xe963;</i>
                          </div>
                          <div class="c-fc-gray c-fs18" v-if="!catalog[index].isLock">已完成{{lesson.ratio}}%</div>
                        </template>
                        <template v-else-if="campDetail.isEnroll && !lesson.isLock">
                          <div class="c-fc-gray c-fs18" v-if="!catalog[index].isLock && lesson.ratio != 0 && campDetail.hasPermission">已完成{{lesson.ratio}}%</div>
                        </template>
                      </div>
                    </div>
                  </div>
                  <wxOpenWeapp class="c-w100 c-h c-opacity0 pa-im c-pz10" :appId="'wx0d7934cc4cdcdd64'" :path="wxappPath" :pathQuety="wxappQuery" v-if="isShowWxLiveApp(lesson)">
                    <div class="c-w100 c-h">小程序直播跳转</div>
                  </wxOpenWeapp>
                </div>
              </template>
            </div>
          </div>
          <loading-status-tem :pt20="true" :noDataText="'暂无训练环节'" :noData="catalog == null || catalog.length == 0"></loading-status-tem>
          <div class="c-fs22 c-fc-sgray c-textAlign-c c-pv20" v-if="catalog && catalog.length > 0">{{listIsPage ? '加载中...':'我是有底线的'}}</div>
        </div>

        <!-- 评论 -->
        <div class="c-minh640" v-if="cfg.enableCommentTag == 1 || campDetail.enableCommentTag == 1" v-show="typeBar == 2">
          <commentCom ref="commentCom" v-show="commentStatus == 1" :prodType="cfrom.camp" :prodId="campId" :bindPhoneSetting="bindPhoneSetting" @getCommentCount="getCommentCount" @addCommentSuccess="addCommentSuccess"></commentCom>
        </div>

        <!-- 相关推荐 -->
        <div class="c-minh640" v-show="typeBar == 3">
          <course-advocate v-if="campDetail.hasPermission" :dataInfo="campDetail" @goCenterProduct="goCenterProduct"></course-advocate>
          <div class="">
            <active-and-column v-if="relationData != ''" :styleType="2" :courseList="relationData.courses" :goodsList="relationData.goods" :soicalList="relationData.socials" :examList="relationData.exams"
              :speechList="relationData.speechs" :mutualList="relationData.mutuals" :datumList="relationData.datums" :eBookList="relationData.ebooks" :circleList="relationData.circle"></active-and-column>
            <circle-relation v-if="circleRelationList.length > 0" @handleClickOpenRelation="handleClickOpenRelation" @handleClickCloseRelation="handleClickCloseRelation" :showOpenRelationModal="showOpenRelationModal" :circleRelationList="circleRelationList"></circle-relation>
          </div>
          <loading-status-tem :pt20="true"
            :noData="circleRelationList.length == 0 && relationData.courses == '' && relationData.goods == '' && relationData.socials == '' && relationData.exams == '' && relationData.speechs == '' && relationData.mutuals == '' && relationData.datums == '' && relationData.ebooks == '' && relationData.circle == ''"
            :noDataText="'暂无推荐'"></loading-status-tem>
        </div>

        <!-- 打卡  -->
        <div v-show="typeBar == 4 && showClockIn" class="c-minh312">
          <div @click="goToClockIn" class="c-flex-row c-pv24 c-ph24">
            <div class="c-ww150 c-hh100 c-text-hidden c-br8">
              <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" :imgClass="'c-br8'" :coverUrl="$addXossFilter(relatedClockIn.cover, require('@/assets/activity_defult.png'))" />
            </div>
            <div class="c-flex-grow1 c-w0 c-flex-row c-aligni-center c-pl20 c-hh100">
              <div class="c-flex-grow1 c-w0 c-pr20  c-flex-column c-justify-sb c-h">
                <div class="c-fs24 c-fw400 c-text-ellipsis1">
                  {{ relatedClockIn.name }}
                </div>
                <div v-if="relatedClockIn.startTime && relatedClockIn.endTime" class="c-fs20 c-fc-gray">
                  有效期：{{ relatedClockIn.startTime.split(" ")[0] }}至{{ relatedClockIn.endTime.split(" ")[0] }}
                </div>
                <div v-if="relatedClockIn.startHour && relatedClockIn.endHour" class="c-fs20 c-fc-gray">时间段：{{ relatedClockIn.startHour.substr(0,5)}}~{{ relatedClockIn.endHour.substr(0,5) }}</div>
              </div>

            </div>
          </div>
        </div>


        <template v-if="campDetail.joinMode == 1 && !campDetail.hasPermission">
          <div class="c-hh52 c-pf c-p-b88 c-p-l0 c-p-r0 c-bg-white c-pz1 c-maxw640 c-mlr-auto">
            <template v-if="hasExpired == false">
              <div class="c-fs20 c-bg-time c-fc-xmlred c-hh52 c-flex-row c-flex-center" v-if="enrollStatus == 1">距报名
                <cj-clocker :time="timeFn()" format="%D天%H时" @on-finish="finishFn">
                </cj-clocker>
              </div>
              <!-- 营期状态为招生中时显示报名截止时间 -->
              <div class="c-fs20 c-bg-time c-fc-xmlred c-hh52 c-flex-row c-flex-center" v-if="enrollStatus == 2">报名截止时间：{{enrollEnd}}</div>
              <!-- 营期状态为待开课时显示报名已结束 -->
              <div class="c-fs20 c-bg-time c-fc-xmlred c-hh52 c-flex-row c-flex-center" v-if="enrollStatus == 3">报名已结束，看看其他内容吧</div>
            </template>
            <template v-else>
              <div class="c-fs20 c-bg-time c-fc-xmlred c-hh52 c-flex-row c-flex-center">营期已结束</div>
            </template>
          </div>
        </template>
        <!-- <more-device :prodInfo="{prodType: ckfrom.camp, prodId: campId}" v-if="!$isWxApp() && isWeChat && campDetail.hasPermission && cfg && cfg.enableMultiLearning == 1 && (cfg.multiLearningPage & 1) == 1 && cfg.multiLearningType > 1 && typeBar == 0"></more-device> -->
        <bottom-buy-com
          ref="bottomBuy"
          :ckFromTitle="'训练营'"
          :ckFrom="78"
          :isNeedPay="!campDetail.hasPermission && (campDetail.payType == 2 || campDetail.payType == 4) && Number(campDetail.price) > 0"
          :showFriendHelper="!campDetail.hasPermission && campDetail.isFriendHelper"
          :friendHelperStatus="faStatus"
          :hasExpired="hasExpired"
          :showBuyButton="!campDetail.hasPermission && !campDetail.isFriendHelper && (campDetail.payType == 2 || campDetail.payType == 4)"
          :showCommentBtn="isShowComments('icon')"
          @spreadInvite="inviteFriends"
          @invitePoster="invitePoster"
          @goHelpDetail="goHelpDetail"
          :showFormText="showFormText"
          @goFormDetail="goForm"
          @clickBuyNow="clickBuyNow"
          @clickComment="addComment"
        >
          <div v-if="isShowComments('tag')" @click="addComment()" class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28">
            <div class="c-hh60 c-w0 c-flex-grow1 c-lh64 c-textAlign-c c-fs24 c-ph20 c-fc-gray c-bg-f2 c-br30"> 请输入评论内容</div>
          </div>
          <div class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28" v-else-if="campDetail.isSaleOut == 0 && !campDetail.hasPermission">
            <div @click="goHomePage" class="theme-bg c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100">商品已停售，看看其他内容吧</div>
          </div>
          <div class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28" v-else-if="isUserGroup">
            <div class="c-bg-ccc c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100">仅指定用户可参与</div>
          </div>
          <div class="c-w0 c-flex-grow1 c-flex-row c-hh64 c-justify-end" v-else-if="!campDetail.hasPermission && campDetail.collage && (campDetail.collage.status == 2 || campDetail.collage.status == 1) && campDetail.collage.userType == -1">
            <div class="c-flex-column c-aligni-center theme-fc c-justify-sa theme-bd1 c-w0 c-flex-grow1 c-br32 c-mr10 c-ml16" @click="enroll">
              <span class="c-fs20 c-lh">{{getBuyBtnTitle}}</span>
              <span class="c-fs22 c-lh">{{'￥' | iosPriceFilter('Live')}}{{calculationPrice}}</span>
            </div>
            <div class="c-flex-column c-aligni-center c-fc-white c-justify-sa c-w0 c-flex-grow1 c-br32" :class="campDetail.collage.status == 2 ? 'theme-bg-gradient' : 'c-bg-d7'" @click="goBuy(-1,campDetail.collage.collageId)">
              <span class="c-fs20 c-lh">发起拼团</span>
              <span class="c-fs22 c-lh">{{'￥' | iosPriceFilter('Live')}}{{Number(campDetail.collage.captainPrice).toFixed(2)}}</span>
            </div>
          </div>
          <!-- 砍价信息不为空 -->
          <div class="c-flex-row c-w100 c-hh88 c-flex-center" v-else-if="!campDetail.hasPermission && campDetail.bargain != null && ((campDetail.bargain.status == 1 && campDetail.bargain.isPreheat == 1) || campDetail.bargain.status == 2)">
            <div class="c-flex-column c-justify-sa c-aligni-center theme-fc c-hh64 theme-bd1 c-w50 c-br32 c-mr10" @click="enroll">
              <span class="c-fs24 c-lh">{{getBuyBtnTitle}}</span>
              <span class="c-fs24 c-lh">{{'￥' | iosPriceFilter}}{{calculationPrice}}</span>
            </div>
            <!-- 未发起砍价 -->
            <template v-if="campDetail.bargain.userType == 1">
              <div class="c-flex-row c-flex-center c-fc-white c-hh64 c-w50 c-fs28 c-br32 theme-bg-gradient" @click="handleClickBargainDetail(campDetail.bargain.bargainId)">正在砍价</div>
            </template>
            <template v-if="campDetail.bargain.userType == -1">
              <div class="c-flex-column c-justify-sa c-aligni-center c-fc-white c-hh64 c-w50 c-br32" :class="(campDetail.bargain.status == 1 && campDetail.bargain.isPreheat == 1) ? 'c-bg-d7' : 'theme-bg-gradient'" @click="handleClickBargainDetail(campDetail.bargain.bargainId)">
                <span class="c-fs24 c-lh">砍价享</span>
                <span class="c-fs24 c-lh">{{'￥' | iosPriceFilter}}{{Number(campDetail.bargain.reservePrice).toFixed(2)}}</span>
              </div>
            </template>
          </div>
          <div v-else-if="!campDetail.hasPermission && campDetail.collage && (campDetail.collage.status == 2 || campDetail.collage.status == 1) && campDetail.collage.userType != -1" class="c-flex-row c-justify-end">
            <div class="c-fs24 theme-fc c-ph40 c-hh64 c-flex-row c-flex-center" @click="goCollageDetail(campDetail.collage.groupId,campDetail.collage.collageId)">拼团中...</div>
          </div>
          <div class="c-w0 c-flex-grow1 c-flex-row c-hh64" v-else-if="!campDetail.hasPermission && campDetail.isFriendHelper">
            <div class="c-w0 c-flex-grow1 c-flex-column c-aligni-center theme-fc c-flex-center theme-bd1 c-br32 c-mr10 c-ml16" @click="enroll">
              <span class="c-fs24 c-lh">{{getBuyBtnTitle}}</span>
              <span class="c-fs24 c-lh c-mt4">{{'￥' | iosPriceFilter}}{{calculationPrice}}</span>
            </div>
            <div class="c-w0 c-flex-grow1 c-flex-column c-flex-center c-fc-white c-br32" :class="faStatus == 2 ? 'theme-bg-gradient' : 'c-bg-d7'" @click="goHelpDetail()">
              <span class="c-fs24 c-lh">灌溉领取</span>
              <span class="c-fs24 c-lh c-mt4">{{'￥' | iosPriceFilter}}0.00</span>
            </div>
          </div>
          <div @click="enroll" class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28" v-else-if="!campDetail.hasPermission && isSales">
            <div :class="showMarketingBar ? 'theme-bg-gradient' : 'theme-bg'" class="c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100">{{getBuyBtnTitle}}</div>
          </div>
          <div @click="enroll" class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28" v-else-if="!campDetail.isEnroll && campDetail.hasPermission && !campDetail.isTeacher">
            <div class="theme-bg c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100">免费参与</div>
          </div>
          <div v-else-if="!campDetail.hasPermission" class="c-w0 c-flex-grow1 c-h c-flex-row c-aligni-center c-justify-sb">
            <div class="c-w100 c-flex-row c-flex-center c-hh64 c-fs28" v-if="campDetail.joinMode == 1">
              <div class="theme-bg c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100" @click="enroll()" v-if="campDetail.termStatus == 2 || campDetail.termStatus == 6">{{campDetail.payType == 1 || campDetail.hasPermission ? '免费参与' : campDetail.payType == 3 ? '密码参与' : '立即报名'}}</div>
              <div class="c-bg-b3 c-fc-white c-lh c-w100 c-flex-row c-flex-center c-h c-br36" v-if="campDetail.termStatus == 1">报名未开始</div>
              <div class="theme-bg c-fc-white c-lh c-w100 c-flex-row c-flex-center c-h c-br36" @click="goHomePage" v-if="campDetail.termStatus == 3 || campDetail.termStatus == 4 || campDetail.termStatus == 5">查看其他内容</div>
            </div>
            <div class="c-w100 c-flex-row c-flex-center c-hh64 c-fs28" v-if="campDetail.joinMode == 2">
              <div class="theme-bg c-fc-white c-flex-row c-flex-center c-h c-br36 c-w100" @click="enroll()">{{campDetail.payType == 1 || campDetail.hasPermission ? '免费参与' : campDetail.payType == 3 ? '密码参与' : '立即报名'}}</div>
            </div>
          </div>
        </bottom-buy-com>

      </section>

      <!-- 打卡证书 -->
      <camp-certifi-com :bigType="1" :prodType='ckfrom.camp' :prodId='campId' :showCertificate="showCertificate" :certInfo='certificateInfo' @closeCertificate='closeCertificate'>
      </camp-certifi-com>
      <!-- 优惠券弹窗 -->
      <coupon-modal v-if="showCouponDialog" :adName="adName" :adCoupon="adCoupon" recordType="78" :osId="campId" :showCouponDialog.sync="showCouponDialog"></coupon-modal>
      <!-- 获得积分 -->
      <show-integrate :showIntegrate="showIntegrate" :integrateCount="integrateCount" v-if="showIntegrate" @closeShareInt="closeShareInt"></show-integrate>
      <!-- 入群引导 -->
      <group-guidance ref="guidance" :isType="false" position="bottom" :groupObject="campDetail.guideData" :startAt="campDetail.joinMode == 2 ? '' : campDetail.startAt"></group-guidance>
    </div>

    <!-- 推荐有礼 -->
    <recommend-present ref="recommendPresent"></recommend-present>
    <coupon-list-com
      @closeModal="closeModal"
      @getCouponList="getCouponList"
      :couponIsPage="couponIsPage"
      :couponLoading="couponLoading"
      :couponList="couponList"
      :showCoupon="showCoupon"
      :prodId="Number(campId)"
      :prodType="78"
      :dataInfo="campDetail"
      :chainInfo="chainInfo"
      :isMarketing="isMarketing"
    >
    </coupon-list-com>
    <offical-account v-if="campDetail && campDetail.bargain" :showAccountQcode="showAccountQcode" :desc="officalDesc" :imgSrc="$addXossFilter(mpQrcode)" @hideDialog="hideDialog"></offical-account>
    <recommend-award v-if="campDetail.recommend && campDetail.recommend.isExist" :action="campDetail.recommend && campDetail.recommend.action"></recommend-award>
    <gift-modal :hasBuy="campDetail.hasPermission" :showGiftModal="popGift" :prodList="campDetail.giftRelates ? campDetail.giftRelates : []" @closeGift="popGift = false"></gift-modal>
    <promote-income class="c-p c-pz1000" v-if="campDetail && campDetail.isSaleOut != 0 && (showInvitionCard || campDetail.showMarketingCard)" :showInvitionCard="showInvitionCard" :showMarketingCard="campDetail.showMarketingCard" :prodId="campId" :prodType="ckfrom.camp" @goInvite="inviteFriends" @goMarketingPoster="invitePoster"></promote-income>
    <!-- 入学证书 -->
    <enrol-cer :isReceivedStudy="isReceivedBuy" ref="enrolcerCom" :bigType="2"></enrol-cer>
    <collage-grades v-if="campDetail" ref="collageGrades" :relType="6" :refereeId="refereeId" :isRelForm="campDetail.isRelForm && !campDetail.hasFormLog" :extId="campId" :bindPhoneSetting="bindPhoneSetting" :goodsRoomId="goodsRoomId" :recRelateId="recRelateId" :recType="recType" :dataInfo="campDetail"></collage-grades>
    <comfirm-com :showPassword.sync="showPassword" :pwTip="campDetail.passwordTip" text="输入密码参与训练营" @submitPassword="submitForm"></comfirm-com>
  </div>

</template>

<script>
import { utilJs, wxUtilJs } from "@/utils/common.js"
import ComfirmCom from "@/components/templates/common/comfirmCom.vue";
import commentCom from "@/components/templates/common/commentCom.vue";
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import campCertifiCom from "./campCertifiCom.vue";
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import couponListCom from "@/components/templates/couponListCom.vue";
import FlashSalesTimeNew from "@/components/templates/flashSalesTimeNew.vue";
import couponModal from "@/components/templates/couponModal.vue";
import DiscountTip from "@/components/templates/common/discountTip.vue";
import BottomBuyCom from "@/components/templates/common/bottomBuyCom.vue";
import CollagePersonsList from "@/components/templates/collage/collagePersonsList.vue";
import recommendPresent from '@/components/templates/recommendPresent'
import groupGuidance from '@/components/templates/common/groupGuidance.vue'
import bargainRules from '@/components/templates/bargain/bargainRules';
import officalAccount from '@/components/templates/common/officalAccount';
import RecommendAward from "@/components/member/recommend/recommendAward.vue";
import giftModal from '@/components/templates/giftModal';
import courseAdvocate from '@/components/templates/courseAdvocate';
import ActiveAndColumn from "@/components/templates/activeAndColumn.vue";
import CircleRelation from "@/components/templates/circleRelation.vue";
import PromoteIncome from '@/components/templates/common/promoteIncome.vue';
import validTimeCom from "@/components/templates/common/validTimeCom.vue";
import { getBindPhoneSetting } from "@/utils/checkUnBindPhone.js";
import { goDetails } from "@/utils/goDetails.js"
import enrolCer from "@/components/templates/learnAndachCer/enrolCer.vue";
import PriceBar from '@/components/templates/common/priceBar.vue';
import DiscountInfo from "@/components/templates/common/discountInfo.vue";
import VipEntry from "@/components/templates/common/vipEntry.vue";
import InviteGroup from "@/components/templates/common/inviteGroup.vue";
import formEntry from "@/components/homePage/form/formEntry.vue";
import MoreDevice from "@/components/templates/moreDevice.vue"
import showIntegrate from "@/components/templates/common/showIntegrate.vue";
import collageGrades from "@/components/templates/collage/collageGrades.vue";
import CoverImg from '@/components/templates/common/coverImg.vue';
import courseDescription from '@/components/templates/courseDescription';
import wxOpenWeapp from '@/components/templates/common/wxOpenWeapp.vue';
import { mapState } from "vuex";
let isLoading = false;
const THEME_RGB_MAP = global.THEME_RGB_MAP;
export default {
  name: "CampDetail",
  components: {
    ComfirmCom,
    formEntry,
    commentCom,
    loadingStatusTem,
    campCertifiCom,
    MySmallTabbar,
    couponListCom,
    FlashSalesTimeNew,
    couponModal,
    DiscountTip,
    BottomBuyCom,
    CollagePersonsList,
    recommendPresent,
    groupGuidance,
    bargainRules,
    officalAccount,
    RecommendAward,
    giftModal,
    courseAdvocate,
    ActiveAndColumn,
    CircleRelation,
    PromoteIncome,
    validTimeCom,
    enrolCer,
    PriceBar,
    DiscountInfo,
    VipEntry,
    InviteGroup,
    MoreDevice,
    showIntegrate,
    collageGrades,
    CoverImg,
    courseDescription,
    wxOpenWeapp
  },
  data() {
    return {
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      cfrom: global.ckFrom,
      campDetail: '',
      typeBar: 0,
      campId: 0,
      is_page: false,
      limit: 10,
      page: 1,
      catalog: [],
      enrollEnd: '',
      showFormText: false,
      campStart: '',
      campEnd: '',
      courseDate: '',
      showPassword: false, //显示密码
      campType: [''],
      isiOS: false,
      showCer: false,
      certificateInfo: {},
      campName: '',
      showCertificate: false, //显示证书
      showCouponDialog: false, //优惠券弹框
      tabList: [{
        title: '详情',
        index: 0
      }, {
        title: '目录',
        index: 1
      }, {
        title: '推荐',
        index: 3
      }],
      tabhBarFixed: false,
      adCoupon: [],
      showCoupon: false,
      couponList: [],
      couponIsPage: false,
      couponPage: 1,
      couponLoading: false,
      // showGuidePop: false,
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      showReward: false, //是否显示毕业福利按钮
      isSales: false,
      vipType: localStorage.getItem("vipType" + localStorage.getItem("userId")),
      enrollStatus: 0, //报名状态 1未开始,2进行中,3已结束
      showDetail: 0, //默认第一项展开
      isShowDirDetail: 1, // 默认展开目在·录
      isCheckEnroll: false, // 判断限制人数
      isSalesBegin: false, // 判断限时购是否正在进行
      showAccountQcode: false,
      officalDesc: '关注我们后才可发起砍价哦',
      mpQrcode: '', //二维码
      listIsPage: false,
      listPage: 1,
      onePage: 1,
      commentStatus: 0,
      cfg: JSON.parse(localStorage.getItem("cfg")),
      isShowFormlg:localStorage.getItem("showForm") == 1 ? true : false,
      learningPosition: null,
      hasExpired: false,
      isEnrollDate: false,
      ckfrom: global.ckFrom,
      bindPhoneSetting: null,
      recType: 0, //推荐类型 1 访问 2 绑定 3 支付
      recRelateId: "", //推荐人ID
      popGift: false, //赠送礼包
      relationData: '',
      circleRelationList: [],
      showOpenRelationModal: false,
      themeId: '', //来源圈子任务的主题id
      relateCollocation: [],
      isReceivedBuy:0,
      enableShowModuleView: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableShowModuleView : 1,
      enableHiddenModules: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableHiddenModules : [],
      chainInfo: '',
      isChainProd: false,
      customPointName: localStorage.getItem("customPointName"),
      optimal: null, // 最低价格返回对象
      isWeChat: utilJs.isWeiXin(),
      adName: '获得完成礼包',
      showIntegrate: false,
      relatedClockIn: [], // 训练营关联的打卡
      integrateCount: 0,
      moreDeviceType: 1, //1: 页面中间 2：固定在底部 进入页面在页面中间，向上滚动后固定在底部
      wxappPath: '',
      wxappQuery: '',
    };
  },
  computed: {
    ...mapState({
      showNavBar: (state) => state.oem_store.showNavBar,
    }),
    // 套壳履约小程序是否显示直播跳转创建直播判断
    isShowWxLiveApp() {
      return function(lessonInfo) {
        return utilJs.getFromApplicationNum() == 5 && lessonInfo.relType == 51;
      }
    },
    showMarketingBar() {
      return this.campDetail && !this.campDetail.hasPermission &&
        ( this.campDetail.sales ||
          (this.campDetail.bargain && ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1) || this.campDetail.bargain.status == 2)) ||
          (this.campDetail.collage && (this.campDetail.collage.status == 2 || this.campDetail.collage.status == 1)) ||
          this.campDetail.isFriendHelper
        )
    },
    // 获取按钮专享价名称
    getBuyBtnTitle() {
      if (this.optimal) {
        const agentName = utilJs.getCustNameMap();
        let btnTxt = '立即报名';
        let chainPrice = this.chainInfo && this.chainInfo.isChainProd ? (this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.isReorder ? this.chainInfo.reorderBonus : this.chainInfo.enableOrderDiscount == 1 ? this.chainInfo.orderBonus : this.campDetail.price) : this.campDetail.price;
        let idDiscount = (this.vipType == 3 || this.vipType > 4) && this.campDetail.commonProdInfo && this.campDetail.commonProdInfo.agentDiscount < 100
          ? this.campDetail.commonProdInfo.agentDiscount
          : (this.vipType == 4 && this.campDetail.svipDiscount < 100)
            ? this.campDetail.svipDiscount
            : (this.vipType == 2 && this.campDetail.vipDiscount < 100)
              ? this.campDetail.vipDiscount
              : 100
        let discountPrice = Number(this.campDetail.price * idDiscount / 100).toFixed(2);
        if (this.chainInfo && this.chainInfo.isChainProd && Number(chainPrice) <= Number(discountPrice)) {
          let chainName = this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.isReorder ? '复购' : (this.chainInfo.userType == 1 ? '普通用户' : this.chainInfo.userType2Name[this.chainInfo.userType])
          btnTxt = chainPrice != this.campDetail.price && chainName ? chainName + '专享价' : '立即报名';
        } else {
          btnTxt = discountPrice * 1 != this.campDetail.price ? (this.vipType != 1 ? (this.vipType == 2 ? 'VIP专享价' : this.vipType == 4 ? 'SVIP专享价' : agentName[this.vipType] + '专享价') : '立即报名') : '立即报名';
        }
        if (this.campDetail.sales && this.optimal.optimalPriceType == 101) {
          btnTxt = '立即报名';
        }
        return btnTxt
      }
      return '立即报名'
    },
    signUpPeople() { // 报名人数= 虚拟数+报名人数
      const enableFictitious = localStorage.getItem("enableFictitious");
      return enableFictitious == 1 ? Number(this.campDetail.subscription || 0) + Number(this.campDetail.people) : this.campDetail.people;
    },
    // 显示评论模块判断
    isShowComments() {
      return (type) => {
        if (this.commentStatus != 1) {
          return false
        }
        // 按全局设置时，评论开关是否都有开启
        const cfgEnableComment = this.cfg && this.cfg.enableComment == 1 && this.cfg.enableTrainingComment == 1
        let isShowComment = false;
        // campDetail.enableComment 评论显示类型 1课程单独设置  2按全局设置；enableCommentBottom=1开启详情下方展示评论开关； enableCommentTag=1开启TAG栏切换显示评论开关
        const campEnableCommentType = this.campDetail.enableComment;
        // 只勾选【详情下方展示评论】，底部才展示评论按钮；若2个样式都勾选/或只勾选TAG栏，则底部评论icon不显示
        if (type == 'icon' && this.typeBar != 2 && ((campEnableCommentType == 1 && this.campDetail.enableCommentBottom == 1 && this.campDetail.enableCommentTag != 1) || (campEnableCommentType == 2 && cfgEnableComment && this.cfg.enableCommentBottom == 1 && this.cfg.enableCommentTag != 1))) {
          isShowComment = true;
        } else if (type == 'tag' && this.typeBar == 2 && ((campEnableCommentType == 1 && this.campDetail.enableCommentTag == 1) || (campEnableCommentType == 2 && cfgEnableComment && this.cfg.enableCommentTag == 1))) {
          isShowComment = true;
        } else if (type == 'detail' && ((campEnableCommentType == 1 && this.campDetail.enableCommentBottom == 1) || (campEnableCommentType == 2 && cfgEnableComment && this.cfg.enableCommentBottom == 1))) {
          isShowComment = true;
        } else {
          isShowComment = false;
        }
        return isShowComment;
      }
    },
    showInvitionCard() {
      let showInvitionCardTmp = !(this.campDetail.isFriendHelper || this.campDetail.bargain || this.isSales || (this.campDetail.collage && (this.campDetail.collage.status == 2 || this.campDetail.collage.status == 1))) && this.campDetail.isInvitationCard == 1 && this.campDetail.recommend && this.campDetail.recommend.isExist == 0
      return showInvitionCardTmp
    },
    // 是否显示证书
    isCertificate() {
      let isCertificate = this.campDetail.isReceiveCard && this.campDetail.isEnroll && this.campDetail.hasPermission && this.campDetail.cardExists;
      return isCertificate;
    },
    showSale() {
      // 没权限 && 价格不为0 && （（开启积分 && 可抵扣金额>0）|| vipdiscount != 100 || (开启svip && svipDiscount！=100)）
      let hasShow = !this.campDetail.hasPermission && Number(this.campDetail.price) != 0 &&
        ((this.companyAuth.enablePoints == 1 && this.campDetail.deductiblePoints > 0) ||
          this.campDetail.vipDiscount * 1 != 100 ||
          (this.campDetail.svipDiscount * 1 != 100))
      return hasShow
    },
    //不是奖金参与//单卖&&没有权限&&价格大于0&&（加入形式&&不是好友助力）&&（优惠券||vip svip折扣信息||积分抵扣）&&（是否参与营销）
    showDiscount() {
      let showdiscount = this.campDetail.payType != 4 && this.campDetail.isSaleOnly != 0 && this.campDetail.hasPermission == false && Number(this.campDetail.price) > 0
      return showdiscount
    },
    //是否是营销活动
    isMarketing() {
      let isMarketing = this.campDetail && (this.campDetail.sales ||
      (this.campDetail.bargain &&
      ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1) ||
      this.campDetail.bargain.status == 2)) ||
      (this.campDetail.collage &&
      (this.campDetail.collage.status == 2 || this.campDetail.collage.status == 1)) || this.campDetail.isFriendHelper)
      return isMarketing
    },
    //不显示优惠券
    isFavourable() {
      let isFavourable = this.campDetail && ((this.campDetail.bargain && ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1) || this.campDetail.bargain.status == 2)) || this.campDetail.isFriendHelper)
      return isFavourable
    },
    //大转盘是否显示
    showTurn() {
      let showturn = this.campDetail.joinActivityInfo && this.campDetail.joinActivityInfo.isJoinActivity == 1
      return showturn;
    },
    //营销原价计算价格
    calculationPrice() {
      let idDiscount = (this.vipType == 3 || this.vipType > 4) && this.campDetail.commonProdInfo && this.campDetail.commonProdInfo.agentDiscount < 100
        ? this.campDetail.commonProdInfo.agentDiscount
        : (this.vipType == 4 && this.campDetail.svipDiscount < 100)
          ? this.campDetail.svipDiscount
          : (this.vipType == 2 && this.campDetail.vipDiscount < 100)
            ? this.campDetail.vipDiscount
            : 100;
      let calculationPrice = Number(this.campDetail.price * idDiscount / 100).toFixed(2);
      if (this.optimal) {
        // 链动价格
        let chainPrice = this.chainInfo && this.chainInfo.isChainProd ? (this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.isReorder ? this.chainInfo.reorderBonus : this.chainInfo.enableOrderDiscount == 1 ? this.chainInfo.orderBonus : this.campDetail.price) : this.campDetail.price;
        // 当链动价格存在且链动价格跟常规身份价格对比时，如果链动小于或者等于身份价格取链动价格
        calculationPrice = Number(chainPrice) <= Number(calculationPrice) ? chainPrice : calculationPrice;
        if (this.campDetail.isFriendHelper) {
          calculationPrice = Number(this.optimal.optimalPrice).toFixed(2);
        }
      }
      return calculationPrice;
    },
    // 判断是否显示推荐有礼
    isRecommend() {
      let isRecommend = this.recType == 3 && this.campDetail.recommend && this.campDetail.recommend.isExist;
      return isRecommend
    },
    isUserGroup() { // true: 指定用户购买或者观看，但是该用户不属于指定用户  false：非指定用户购买或者观看，或者该用户属于指定用户
      let isUserGroup = this.campDetail.isTeacher != 1 && (this.campDetail.permissionType == 0 || this.campDetail.permissionType == 1 || this.campDetail.permissionType == 2 || this.campDetail.permissionType == 3 || this.campDetail.permissionType == 18 || this.campDetail.permissionType == 19) && (this.campDetail.isUserGroup == 1 && this.campDetail.isInUserGroup != 1);
      return isUserGroup;
    },
    isShowVipPrice() {
      return !this.isMarketing && this.campDetail.payType != 4 && this.campDetail.price * 1 > 0 && (((this.vipType == 3 || this.vipType > 4) && this.campDetail.commonProdInfo && this.campDetail.commonProdInfo.isAgent == 1 && Number(this.campDetail.commonProdInfo.agentDiscount) < 100) || ((this.vipType == 1 || this.vipType == 2) && Number(this.campDetail.vipDiscount) < 100) || (this.vipType == 4 && Number(this.campDetail.svipDiscount) < 100))
    },
    isShowGuide () { // 是否展示入群引导弹窗入口
      const campDetail = this.campDetail || {}
      const guideData = campDetail.guideData || {}
      const guideType = guideData.guideType || []
      const showPosition = campDetail && guideData && (guideData.showPosition == 3 || (guideData.showPosition == 1 && !campDetail.hasPermission) || (guideData.showPosition == 2 && campDetail.hasPermission))
      // 有设置入群引导 && 开关开启 &&（详情页引导 || 详情页弹窗）&& （有权限 || （免费 && 无权限））
      return campDetail && guideData && guideData.isOpenGuide == 1 && (guideType.includes(1) || guideType.includes(3)) && showPosition
    },
    showClockIn() { // 是否显示打卡
      // 打卡不下架
      return this.showRelatedClockIn == 1 && this.relatedClockIn.status != 0
    }
  },
  created() {
    utilJs.appShare(this);
  },
  watch: {
    $route(to, from) {
      if (to.path == '/homePage/camp/campDetail' && from.path == '/homePage/camp/campDetail') {
        this.initData();
      }
    }
  },
  activated() {
    this.initData();
  },
  methods: {
    addCommentSuccess() {
      this.$nextTick(() => {
        // 确保详情tab下的评论列表和评论tab下的列表数据可以同时更新
        if (this.typeBar == 0 && this.$refs.commentCom) {
          this.$refs.commentCom.public_initData()
        }
        if (this.typeBar == 2 && this.$refs.detailCommentCom) {
          this.$refs.detailCommentCom.public_initData()
        }
      })
    },
    getCommentCount(count = 0) {
      if (count && count > 0) {
        const index = this.tabList.findIndex(i => i.title == '评论')
        index > -1 && this.$set(this.tabList[index], "smallNum", count);
      }
    },
    addComment() {
      const index = this.tabList.findIndex(i => i.title == '评论')
      this.typeBar = index > -1 ? this.tabList[index].index : 0
      this.$nextTick(() => {
        if (index > -1 && this.$refs.commentCom) {
          this.$refs.commentCom.public_addComment()
        } else if (this.$refs.detailCommentCom) {
          this.$refs.detailCommentCom.public_addComment()
        }
      })
    },
    goToClockIn() {
      const $this = this
      // （没权限|| 有权限没报名）并且不是老师
      if ((!this.campDetail.hasPermission || (this.campDetail.hasPermission && !this.campDetail.isEnroll) ) && !this.campDetail.isTeacher) {
        if (!this.permissionWarn()) {
          return
        }
      }

      $this.$routerGo(this, "push", {
        path: "/homePage/clockIn/clockInDetail",
        query: {
          clockInId: $this.relatedClockIn.signColId
        }
      });
    },
    //关闭积分弹窗
    closeShareInt() {
      this.showIntegrate = false;
    },
    // 获取礼包--
    getFinishReward(tlId) {
      // 'isPartCompleteShow' 环节完成展示 1 展示 0 不展示
      // 'isTermCompleteShow' 营期完成展示 1 展示 0 不展示
      // 'rewardType' 1 积分奖励 2 优惠券奖励
      // partPoints 环节完成奖励的积分  points 营期完成奖励的积分
      let postUrl = `${global.apiurl}k12/trainings/checkTermFinishReward`;
      let sendData = {
        tlId: tlId
      }
      utilJs.postMethod(postUrl, sendData, res => {
       const data = res
      // 不是环节完成&&不是营期完成
       if (data.isPartCompleteShow == 0 && data.isTermCompleteShow == 0) {
        return
       }
       if (data.rewardType == 1) { // 积分 &&
        let getPoints = 0
        if (data.isPartCompleteShow == 1 ) {
          getPoints += data.partPoints
        }
        if (data.isTermCompleteShow == 1) {
          getPoints += data.points
        }
        this.showIntegrate = true
        this.integrateCount = getPoints
       } else if (data.rewardType == 2 && data.isTermCompleteShow == 1) { // 优惠券
        this.getReward();
       }
      });
    },
    goHomePage() {
      this.$routerGo(this, "push", {
        path: "/"
      });
    },
    popPresentCamp() {
      if (this.$refs.bottomBuy) {
        this.$refs.bottomBuy.isShowPresent = true;
      }
    },
    getProdRelateCollocation() {
      utilJs.getMethod(`${global.apiurl}prodsCollocation/getProdRelateCollocation?prodType=78&prodId=${this.campId}`,
        res => {
          this.relateCollocation = res.data ? res.data : [];
        }
      );
    },
    judgeCompliance() {
      let postUrl = `${global.apiurl}Certificate/judgeCompliance?prodType=${global.ckFrom.camp}&prodId=${this.campId}`;
      // enableStudyCard	number
      // 是否有设置学习证书1=是；0=否
      // isReceivedStudy	number
      // 是否已经领取了证书：1=是；0=否
      // isComplianceStudy	number
      // 是否达到学习证书发放条件：1=是；0否
      // studyHonorImage	string
      // 学习证书图片（如果领取了会有图片）
      // enableBuyCard	number
      // 是否有设置入学证书1=是；0=否
      // isReceivedBuy	number
      // 是否已经领取了入学证书：1=是；0=否
      // isComplianceBuy	number
      // 是否达到入学证书发放条件：1=是；0否
      // buyHonorImage	string
      // 入学证书证书图片（如果领取了会有图片）
      utilJs.getMethod(postUrl, res => {
        if (res.enableBuyCard == 1 && res.isComplianceBuy == 1 && res.isReceivedBuy == 0) {
          this.isReceivedBuy = res.isReceivedBuy
          let enrolCerLoca = global.ckFrom.camp + '-' + this.campId
          if (JSON.parse(localStorage.getItem("enrolCer")) == enrolCerLoca) {
              return
          } else {
            this.$refs.enrolcerCom.drawNow('', this.campId, global.ckFrom.camp)
          }
        }
      });
    },

    initData() {
      this.isiOS = navigator.userAgent.indexOf("IOSLogin") > -1 || navigator.userAgent.indexOf('IOSNewLogin') > -1 || navigator.userAgent.indexOf("IOSNewApp") > -1;
      this.tabList = [{
        title: '详情',
        index: 0,
      }, {
        title: '目录',
        index: 1,
      }, {
        title: '推荐',
        index: 3,
      }];
      this.goodsRoomId = this.$route.query.goodsRoomId || "";
      this.campId = this.$route.query.campId || "";
      this.ckFrom = this.$route.query.ckFrom || global.ckFrom.camp;
      this.recRelateId = this.$route.query.recRelateId || '';
      this.recType = this.$route.query.recType || '';
      this.campDetail = '';
      this.catalog = [];
      this.is_page = false;
      this.commentList = [];
      this.limit = 10;
      this.page = 1;
      this.typeBar = 0;
      this.showPassword = false; //显示密码
      this.campType = '';
      this.showCertificate = false;
      this.showCer = false;
      this.showCouponDialog = false;
      this.tabhBarFixed = false;
      this.adCoupon = [];
      this.enrollStatus = 0;
      this.cloroRGB = THEME_RGB_MAP[this.theme];
      this.couponPage = 1;
      this.couponIsPage = false;
      this.couponLoading = false;
      this.showCoupon = false;
      // this.showGuidePop = false;
      this.showReward = false;
      this.couponList = [];
      this.isSales = false;
      this.showDetail = 0;
      this.listIsPage = false;
      this.listPage = 1;
      this.commentStatus = 0;
      this.showFormText = false;
      this.hasExpired = false;
      this.isEnrollDate = false;
      this.popGift = false;
      this.relationData = '';
      this.circleRelationList = [];
      this.showOpenRelationModal = false;
      this.themeId = this.$route.query.themeId || '';
      this.relateCollocation = [];
      this.chainInfo = '';
      this.isChainProd = false;
      this.optimal = null;
      this.moreDeviceType = 1;
      getBindPhoneSetting(global.ckFrom.camp).then(res => {
        this.bindPhoneSetting = res;
      });
      utilJs.getChainInfo(global.ckFrom.camp, this.campId).then(res => {
        this.chainInfo = res;
        this.isChainProd = this.chainInfo && this.chainInfo.isChainProd;
      });
      this.getCampDetail(1);
      this.getCouponList();
      this.isRecommendPage();
      this.getTermRelationTheme();
      this.judgeCompliance();
    },
    handleClickOpenRelation() {
      this.showOpenRelationModal = true;
    },
    handleClickCloseRelation() {
      this.showOpenRelationModal = false;
    },
    getTermRelationTheme() {
      utilJs.getMethod(global.apiurl + `circle/getTermRelationTheme?campId=${this.campId}`, res => {
        this.circleRelationList = res[0];
      })
    },
    joinCircle() {
      this.$routerGo(this, "push", {
        path: "/homePage/circle/circleFeed",
        query: {id: this.campDetail.circleList[0].circleId}
      });
    },
    goCenterProduct(tItem) {
      let type = tItem.prodType;
      if (type == 1 || type == 23 && tItem.vipInfo) {
        if (tItem.vipInfo.isCollage == 1) {
          this.$routerGo(this, "push", {
            path: "/homePage/collage/vipCollage",
            query: {
              prodId: tItem.vipInfo.id,
              isCollage: true
            }
          });
        } else {
          this.$routerGo(this, "push", {
            path: "/member/vip/vipDetail",
            query: {
              type: tItem.prodType,
              fromCmpId: tItem.vipInfo.id
            }
          })
        }
        //  else if (tItem.vipInfo.isMarketing == 1) {
        //   this.$routerGo(this, "push", {
        //     path: "/member/vip/vipBuy",
        //     query: {
        //       prodId: tItem.vipInfo.id,
        //       pId: tItem.vipInfo.marketID,
        //       type: type == 1 ? this.ckfrom.flashSalesVip : this.ckfrom.flashSalesSvip
        //     }
        //   })
        // } else {
        //   this.$routerGo(this, "push", {
        //     path: "/member/vip/vipBuy",
        //     query: {
        //       prodId: tItem.vipInfo.id,
        //       type: type == 1 ? this.ckfrom.vip : this.ckfrom.svip
        //     }
        //   })
        // }
        return;
      }
      let query = {}
      let prodId = type == 78 ? tItem.subId : tItem.id;
      if (type == 76) {
        query.relType = tItem.type;
        query.type = 2;
      }
      goDetails(this, type, prodId, query, tItem.courseType);
    },
    popGiftModal() {
      this.popGift = true;
    },
    handleClickCertificate() {
      // 判断是否需要显示毕业福利
      let curCampId = this.campId * 1;
      let localCampCoupArr = localStorage.getItem("campCoupArray")
        ? JSON.parse(localStorage.getItem("campCoupArray"))
        : [];
      if (!localCampCoupArr.includes(curCampId) && this.campDetail.rewardType == 2) {
        this.showReward = true;
      } else {
        this.showReward = false;
      }
      this.getCertificate();
    },
    // 未达标
    handleClickStandard(item) {
      this.$cjConfirm({
        title: '完成条件', //
        titleCenter: true, //标题是否居中
        message: item.completeConditions,
        messageCenter: true, //内容是否居中
        showMasker: true, //是否显示透明背景
        clickCloseModal: false, //是否点击透明背景关闭弹窗
        showCancelButton: false, //是否显示取消按钮
        cancelButtonText: '', //取消按钮文本
        confirmButtonText: '', //确认按钮文本
        onConfirm() {},
        onCancel() {},
      })
    },
    // 记录上次学习位置
    setCampProgress(lessIndex, index) {
      let data = {
        prodId: this.campId,
        prodType: global.ckFrom.camp,
        innerIndex: lessIndex,
        outIndex: index,
        // 新增tlId，防止后台移动学习任务或学习环节，上次学习位置对不上，获取训练营详情接口会根据tlId，重新匹配tlId在目录的位置
        tlId: this.catalog[index] && this.catalog[index].lessons && this.catalog[index].lessons[lessIndex] ? this.catalog[index].lessons[lessIndex].id : '',
        page: Math.floor(index / 10) + 1
      };
      let postUrl = `${global.apiurl}analysis/course/positionLog`;
      utilJs.postMethod(postUrl, data, res => { });
    },
    // 赠送好友
    clickBuyNow() {
      // 有入群引导信息&&开启入群引导&&详情页底部弹窗引导 去购买前先缓存当前训练营id，等购买回来，有权限后自动弹出一次
      // if (this.campDetail && this.campDetail.guideData && this.campDetail.guideData.isOpenGuide == 1 && this.campDetail.guideData.guideType.includes(3) && !this.campDetail.hasPermission) {
      //   localStorage.setItem(`showGuideCampId`, this.campId)
      // }
      let queryT = null;
      let pId = this.campDetail.sales && this.isSales ? this.campDetail.sales.pId : null;
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (!this.campDetail.isTeacher && this.campDetail.collectPage == 1 && this.campDetail.collectPage != 3 && this.campDetail.isRelForm && !this.campDetail.hasFormLog && localStorage.getItem("showForm") == 1) {
        this.goForm(1);
      } else {
        queryT = {
          cId: 0,
          extId: this.campId,
          ckFrom: global.ckFrom.presentCamp,
          isFromInvite: 0
        }
        if (this.campDetail.sales && this.campDetail.sales.pId && this.isSales) {
          queryT.pId = pId;
        }
        if (this.goodsRoomId) {
          queryT.goodsRoomId = this.goodsRoomId;
        }
        this.$routerGo(this, "push", {
          path: "/homePage/course/coursePay",
          query: queryT
        });
      }
    },
    hideDialog() {
      this.showAccountQcode = false;
    },
    checkUserIsFollowedMp() {
      let _this = this;
      return new Promise(function (resolve, reject) {
        utilJs.getMethod(`${global.apiurl}bargains/getMpData?bargainId=${_this.campDetail.bargain.bargainId}`,
          res => {
            resolve(res);
          },
          failRes => {
            reject(failRes)
          }
        )
      })
    },
    // 砍价跳转
    handleClickBargainDetail(bargainId) {
      if (this.campDetail.bargain.status == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能砍价！',
          type: 'warn'
        });
        return;
      }
      utilJs.postMethod(`${global.apiurl}k12/trainings/${this.campId}/checkEnroll`, {}, res => {
        this.isCheckEnroll = true;
        if (this.isCheckEnroll) {
          this.checkUserIsFollowedMp().then(res => {
            if (res.threshold == 2 && res.isFollowedMp == 0) {
              this.mpQrcode = res.mpQrcode;
              this.showAccountQcode = true;
              return;
            }
            if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
              if (utilJs.goBindMobile()) return;
            }
            if (!this.campDetail.isTeacher && this.campDetail.collectPage == 1 && this.campDetail.isRelForm && !this.campDetail.hasFormLog && localStorage.getItem("showForm") == 1) {
              let pId = this.isSales ? this.campDetail.sales.pId : null;
              let joinType = this.campDetail.hasPermission && !this.campDetail.isEnroll ? 1 : this.campDetail.payType;
              let isGoBack = this.campDetail.hasPermission ? 1 : 0;
              let goPath = `/homePage/form?relId=${this.campId}&ttId=${this.campId}&relType=6&type=1&ckFrom=${this.isSales ? global.ckFrom.flashSalesCamp : this.ckFrom}&joinType=${joinType}&cId=-1&extId=${this.campId}&pId=${pId}&isGoBack=${isGoBack}&bargainId=${bargainId}`;
              goPath = this.goodsRoomId ? `${goPath}&goodsRoomId=${this.goodsRoomId}` : goPath;
              this.$routerGo(this, "push", {
                path: goPath
              });
            } else {
              if (this.campDetail.bargain.status == 2) {
                this.$routerGo(this, "push", {
                  path: "/homePage/bargain/bargainDetail",
                  query: {
                    bargainId: bargainId
                  }
                });
              }
            }
          })
        }
      },
      failRes => {
        this.isCheckEnroll = false;
      });
    },
    handleShowGuidePop() {
      // 显示入群引导
      this.$refs.guidance.isShowPop();
    },
    foldAndUnfold(index, item) {
      if (this.isShowDirDetail == 1) {
        return true;
      } else {
        // 展开折叠
        if (this.showDetail == index) {
          this.showDetail = -1;
        } else {
          this.showDetail = index;
        }
      }
    },
    closeModal() {
      this.showCoupon = false;
    },
    //获取可以领取的优惠券
    getCouponList: function () {
      if (!this.couponLoading) {
        this.couponLoading = true;
        let $this = this;
        utilJs.getMethod(global.apiurl + 'redeemCodes/getCouponsByRedeemType?courseId=' + this.campId + '&redeemType=91&limit=10&page=' + this.couponPage, function (res) {
          $this.couponLoading = false;
          $this.couponList = $this.couponList.concat(res.data);
          $this.couponPage = res.next_page_url ? ($this.couponPage + 1) : $this.couponPage;
          $this.couponIsPage = res.next_page_url ? true : false;
        },
          failRes => {
            $this.couponLoading = false;
          }
        );
      }
    },
    clickDesc(e) {
      if (e.target.tagName == 'IMG' && e.target.src) {
        wxUtilJs.previewImage({
          current: e.target.src, // 当前显示图片的http链接
          urls: [e.target.src] // 需要预览的图片http链接列表
        });
      }
    },
    //邀请好友
    inviteFriends: function () {
      if (this.bindPhoneSetting && this.bindPhoneSetting.shareBind) {
        if (utilJs.goBindMobile()) return;
      }
      let ckFrom = global.ckFrom.camp;
      let extId = this.campId;

      this.$routerGo(this, "push", {
        path: "/homePage/spread/spreadCustom",
        query: { cId: -1, extId: extId, ckFrom: ckFrom }
      });
    },
    //活动海报
    invitePoster: function () {
      if (this.bindPhoneSetting && this.bindPhoneSetting.shareBind) {
        if (utilJs.goBindMobile()) return;
      }
      let ckFrom = global.ckFrom.camp;
      let type = this.campDetail.collage ? 3 : this.campDetail.sales ? 2 : this.campDetail.bargain ? 5 : 4;//this.ckFrom == global.ckFrom.course ? 0 : this.extId;
      let cId = this.campDetail.isFriendHelper ? this.campDetail.faId : this.campDetail.collage ? this.campDetail.collage.collageId : this.campDetail.bargain ? this.campDetail.bargain.bargainId : this.campDetail.sales.pId; //this.campDetail.faId;
      let proId = this.campId;
      this.$routerGo(this, "push", { path: '/homePage/spread/spreadPoster', query: { cId: cId, type: type, ckFrom: ckFrom, proId: proId } });
    },
    //助力详情
    goHelpDetail: function () {
      if (this.bindPhoneSetting && this.bindPhoneSetting.helpBind && utilJs.goBindMobile()) {
        return;
      }
      if ((this.campDetail.termStatus == 3 || this.campDetail.termStatus == 4 || this.campDetail.termStatus == 5) && this.hasExpired == false && this.campDetail.joinMode == 1) {
        this.$showCjToast({
          text: '报名已截止',
          type: 'warn'
        });
        return;
      }
      if (this.hasExpired && this.campDetail.joinMode == 1) {
        this.$showCjToast({
          text: '营期已结束',
          type: 'warn'
        });
        return;
      }
      if (this.faStatus == 1 && this.hasExpired == false && this.campDetail.joinMode == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能助力领取！',
          type: 'warn'
        });
      } else if (this.faStatus == 1 && this.campDetail.joinMode == 2) {
        this.$showCjToast({
          text: '活动未开始，暂不能助力领取！',
          type: 'warn'
        });
      } else {
        this.$routerGo(this, "push", {
          path: "/homePage/task/task",
          query: { 'faId': this.campDetail.faId, 'refereeId': localStorage.getItem("userId") }
        });
      }
    },
    // 限时购倒计时
    falshSalesTime(status) {
      if (this.campDetail.sales) {
        this.campDetail.sales.sales.status = status
      } else if (this.campDetail.isFriendHelper) {
        this.faStatus = status;
      } else if (this.campDetail.bargain) {
        this.campDetail.bargain.status = status
      }
    },
    // 限时购倒计时结束
    finishFlashSales(status) {
      if (this.campDetail.sales) {
        this.campDetail.sales.sales.status = status
      } else if (this.campDetail.isFriendHelper) {
        this.faStatus = status;
        this.getCampDetail(2);
      } else if (this.campDetail.bargain) {
        this.getCampDetail(2);
      }
      if (status == 2) {
        this.isSales = true;
      } else {
        this.isSales = false;
      }
      if (status == -1) {
        this.campDetail.sales = null;
      }
    },
    //友情灌溉倒计时
    friendTimeFn: function () {
      let stime = this.campDetail ? utilJs.getTimeByDate(this.campDetail.faStartAt) : 0;
      let etime = this.campDetail ? utilJs.getTimeByDate(this.campDetail.faEndAt) : 0;
      let nowTime = (new Date()).getTime();
      //faStatus 1未开始,2进行中,3已结束,4已停止
      let time = '';
      if (stime > nowTime) {
        this.faStatus = 1;
        time = this.campDetail.faStartAt;
      } else if (etime > nowTime) {
        this.faStatus = 2;
        time = this.campDetail.faEndAt;
      }
      return time;
    },
    //友情灌溉倒计时结束修改状态
    friendFinishFn: function () {
      if (this.faStatus == 1) {
        this.faStatus = 2;
        this.friendTimeFn();
      } else {
        this.campDetail.isFriendHelper = false;
        this.faStatus = 3;
      }
    },
    gcd: function (cinfo) {
      this.goCollageDetail(cinfo.groupId, cinfo.collageId);
    },
    //拼团详情
    goCollageDetail: function (groupId, collageId) {
      if (this.isUserGroup) {
        this.$showCjToast({
          text: '指定用户可以购买',
          type: 'text'
        });
        return;
      }
      if (this.campDetail.collage.userType != -1 && this.campDetail.collage.groupId != groupId) {
        this.$showCjToast({
          text: '您已在拼团中，不需要再去拼单啦！',
          type: 'warn'
        });
      } else {
        if (this.campDetail.collage.status == 1) {
          this.$showCjToast({
            text: '活动未开始，暂不能拼团！',
            type: 'warn'
          });
        } else {
          let hfs = this.campDetail.isRelForm && !this.campDetail.hasFormLog;
          let pathQuery = {
            'groupId': groupId,
            'collageId': collageId,
            isRelForm: hfs,
            extId: this.campId,
            relType: 6,
            recType: this.recType,
            recRelateId: this.recRelateId,
          };
          if (this.goodsRoomId) {
            pathQuery.goodsRoomId = this.goodsRoomId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/collage/collageDetail",
            query: pathQuery
          });
        }
      }
    },
    //拼团详情
    goBuy: function (groupId, collageId) {
      if (this.isUserGroup) {
        this.$showCjToast({
          text: '指定用户可以购买',
          type: 'text'
        });
        return;
      }
      if (this.campDetail.collage.userType != -1 && this.campDetail.collage.groupId != groupId) {
        this.$showCjToast({
          text: '您已在拼团中，不需要再去拼单啦！',
          type: 'warn'
        });
      } else {
        if (this.campDetail.collage.status == 1) {
          this.$showCjToast({
            text: '活动未开始，暂不能拼团！',
            type: 'warn'
          });
        } else {
          //要加判断是否选择阶梯
          if (this.campDetail.collage && this.campDetail.collage.collageGroupType == 1 ) {
            this.$refs.collageGrades.goChoseBuy()
          } else {
            this.$refs.collageGrades.showBuy()
            // this.isShowBuy = true; //选择阶梯
          }
        }
      }
    },
    // 获取毕业福利(优惠券)
    getReward: function () {
      let postUrl = `${global.apiurl}k12/trainings/${this.campId}/card/couponShow`;
      utilJs.getMethod(postUrl, res => {
        this.showCouponDialog = true;
        this.adCoupon = res;
      },
        failRes => {
          isLoading = false;
        });
    },
    //关闭证书
    closeCertificate() {
      this.showCertificate = false;
    },
    //点击奖金细则
    clickGoRules() {
      this.$routerGo(this, "push", {
        path: `/homePage/clockIn/bonusRules?workType=4`
      });
    },
    //改变typeBar
    changeType: function (typeBar) {
      this.typeBar = typeBar;
      this.handleScroll();
      if (typeBar == 1 && this.learningPosition != null) {
        this.scrollToLearn();
      }
    },
    //添加学习记录
    watchRecord: function () {
      let data = {
        ckFrom: this.ckFrom,
        extId: this.campId, //营期ID
        cId: -1
      }
      utilJs.postMethod(`${global.apiurl}common/playRecord`, data, res => { });
    },
    // 报名未开始时记录访问量
    visitRecord: function () {
      let data = {
        trainTermId: this.campId
      }
      utilJs.postMethod(`${global.apiurl}k12/trainings/addVisitPeople`, data, res => {
        localStorage.setItem(`${localStorage.getItem("userId")}camp${this.campId}`, true);
      });
    },
    //跳转至大转盘
    goTOturn() {
      let $this = this
      $this.$routerGo($this, "push", {
        path: "/homePage/marketing/turntable",
        query: {
          taId: $this.campDetail.joinActivityInfo.activityData.id
        }
      });
    },
    // 获取训练营详情
    getCampDetail: function (fromOtherPage) { //从别的页面进入此页面，tablist才需要添加评论
      let $this = this;
      let postUrl = `${global.apiurl}k12/trainings/${$this.campId}?isSkeleton=1&themeId=${this.themeId}`;
      utilJs.getMethod(postUrl, res => {
        if (JSON.stringify(res) === '[]') {
          $this.$routerGo($this, "replace", {
            path: `/error/emptyPage?from=''&info=该训练营已下架，请联系管理人员！`
          });
        } else {
          setDocumentTitle(res.name || " "); // eslint-disable-line
          if (res.isValid == 2 && (res.permissionType == 0 || res.permissionType == 2 || res.permissionType == 3 || res.permissionType == 19)) {
            $this.hasExpired = utilJs.getTimeByDate(res.validAt) - (new Date()).getTime() < 0;
          } else if (res.isValid == 0 && res.hasPermission && res.isEnroll && res.expireTime) {
            $this.hasExpired = utilJs.getTimeByDate(res.expireTime) - (new Date()).getTime() < 0;
          }
          // 判断是否已经过期
          $this.isEnrollDate = utilJs.getTimeByDate(res.enrollEndAt) - (new Date()).getTime() < 0;
          $this.campDetail = res;
          $this.optimal = res.optimal || null;
          if ($this.campDetail.isCopy > -1) { //-1：使用全局变量 1：允许复制 0：禁止复制
            $this.cfg.isCopy = $this.campDetail.isCopy;
          }
          if ($this.campDetail.isCopyPicture > -1) { //-1：使用全局变量 1：允许复制 0：禁止复制
            $this.cfg.isCopyPicture = $this.campDetail.isCopyPicture;
          }
          $this.isShowDirDetail = res.isShowDirDetail;
          $this.learningPosition = res.learningPosition;
          // 是否有关联打卡
          $this.showRelatedClockIn = res.showRelatedClockIn || 0;
          $this.relatedClockIn = res.relatedClockIn || {};
          if ($this.showRelatedClockIn == 1 && !!$this.relatedClockIn && $this.relatedClockIn.status == 1 && !$this.tabList.find(el => el.index == 4)) {
            // 处理一下排序
            $this.tabList.splice(3, 0, {
              title: '打卡',
              index: 4
            });
          }

          // 判断当前为什么模式，收缩还是展开
          if ($this.isShowDirDetail == 0 && $this.learningPosition != null) {
            if ($this.learningPosition.outIndex != 0) {
              $this.foldAndUnfold($this.learningPosition.outIndex)
            }
          }
          // 是否显示赠送好友
          $this.campDetail.showPresentFriend = $this.cfg.enableSales == 1 && !$this.isiOS && Number(res.price) > 0 && res.isSaleOut != 0 && (!$this.isEnrollDate && res.joinMode == 1 || res.joinMode == 2) && $this.campDetail.isUserGroup != 1;
          $this.showFormText = !res.isTeacher && res.collectPage != 3 && res.hasPermission == true && res.isRelForm == true && res.hasFormLog == false && localStorage.getItem("showForm") == 1 ? true : false;
          if ($this.campDetail.joinActivityInfo && $this.campDetail.joinActivityInfo.isShowDialog == 1) {
            $this.$cjConfirm({
              title: '', //
              titleCenter: true, //标题是否居中
              message: '恭喜！您获得了大转盘抽奖机会！',
              messageCenter: true, //内容是否居中
              showMasker: true, //是否显示透明背景
              clickCloseModal: false, //是否点击透明背景关闭弹窗
              showCancelButton: true, //是否显示取消按钮
              cancelButtonText: '稍后再说', //取消按钮文本
              confirmButtonText: '立刻前往', //确认按钮文本
              onConfirm() {
                $this.$routerGo($this, "push", {
                  path: "/homePage/marketing/turntable",
                  query: {
                    taId: $this.campDetail.joinActivityInfo.activityData.id
                  }
                });
              }
            })
          }
          $this.enrollEnd = utilJs.dateFormatNew(res.enrollEndAt, "YYYY.MM.DD HH:mm");
          $this.campStart = utilJs.dateFormatNew(res.startAt, "MM月DD日 HH:mm");
          $this.campEnd = utilJs.dateFormatNew(res.endAt, "MM月DD日 HH:mm");
          $this.timeFn();
          $this.$nextTick(() => {
            if (!$this.campDetail.hasPermission) {
              $this.getProdRelateCollocation();
            }
            window.addEventListener('scroll', $this.handleScroll);
            const guideData = $this.campDetail.guideData || null
            // const { payType, hasPermission, isEnroll } = $this.campDetail
            const { hasPermission } = $this.campDetail
            // const showGuideCampId = localStorage.getItem(`showGuideCampId`) || 0
            const showPosition = guideData && (guideData.showPosition == 3 || (guideData.showPosition == 1 && !hasPermission) || (guideData.showPosition == 2 && hasPermission))
            if (!$this.campDetail.isTeacher && $this.$refs.guidance && guideData && guideData.isOpenGuide == 1 && $this.campDetail.guideData.guideType.includes(3) && showPosition) {
              utilJs.getLeadSocialLog($this.ckfrom.camp, $this.campId).then(dataRes => {
                if (!dataRes || dataRes == '') {
                  $this.$refs.guidance.isShowPop();
                  utilJs.saveLeadSocialLog($this.ckfrom.camp, $this.campId)
                }
              })
            }
            // 非讲师 && 有入群引导信息并开启入群引导 && ((免费 && 未报名) || (非免费 && 有权限 && 刚从支付页回来))  自动显示入群引导
            // if (!$this.campDetail.isTeacher && $this.$refs.guidance && guideData && guideData.isOpenGuide == 1 && ((payType == 1 && !isEnroll) || (payType != 1 && hasPermission && showGuideCampId == $this.campId)) && guideData.guideType.includes(3)) {
            //   $this.$refs.guidance.isShowPop();
            // }
            // localStorage.removeItem(`showGuideCampId`)
          });
          // 按单独课程设置：有开启tag显示
          const campEnableCommentTag = this.campDetail.enableComment == 1 && this.campDetail.enableCommentTag == 1
          // 按全局设置：有开启tag显示
          const cfgEnableCommenTag = this.campDetail.enableComment == 2 && this.cfg && this.cfg.enableComment == 1 && this.cfg.enableTrainingComment == 1 && this.cfg.enableCommentTag == 1
          if (!this.tabList.find(el => el.index == 2) && fromOtherPage == 1 && (campEnableCommentTag || cfgEnableCommenTag)) {
            this.tabList.push({
              title: '评论',
              index: 2,
              smallNum: 0
            })
          }
          $this.relevance();
          // $this.getCata();
          // tabsType 1：没有权限详情页；有权限目录，2：训练营详情，3：训练营目录
          $this.typeBar = ((res.tabsType == 2 || (res.tabsType == 1 && !res.hasPermission)) ? 0 : 1);
          if ((res.termStatus == 1 || res.termStatus == 2 || res.termStatus == 6 || this.campDetail.joinMode == 2) && !localStorage.getItem(`${localStorage.getItem("userId")}camp${$this.campId}`)) {
            $this.visitRecord();
          }
          // 获取礼包信息
          // if ($this.typeBar == 1 && $this.learningPosition) {
          if ($this.learningPosition) { //之前需要tab在目录的时候才会展示？产品说可以去掉
            this.getFinishReward($this.learningPosition.tlId)
          }

          // 判断是否需要显示毕业福利
          let curCampId = this.campId * 1;
          let localCampCoupArr = localStorage.getItem("campCoupArray")
            ? JSON.parse(localStorage.getItem("campCoupArray"))
            : [];
          if (!localCampCoupArr.includes(curCampId) && $this.campDetail.rewardType == 2) {
            $this.showReward = true;
          } else {
            $this.showReward = false;
          }
          // 拼团 报名未截止才可以拼团
          if (res.collage != null && this.companyAuth.enableCollage == 1 && (this.campDetail.termStatus != 3 && this.campDetail.termStatus != 4 && this.campDetail.termStatus != 5 && this.hasExpired == false || this.campDetail.joinMode == 2)) {
            let nt = (new Date()).getTime();
            let st = utilJs.getTimeByDate(res.collage.startTime);
            let et = utilJs.getTimeByDate(res.collage.endTime);
            if (nt >= st && nt < et && res.collage.status < 3) {
              this.campDetail.collage.status = 2;
            } else if (nt < st && res.collage.status == 1) {
              this.campDetail.collage.status = 1;
            } else if (nt >= et && res.collage.status == 2) {
              this.campDetail.collage.status = 3;
              this.campDetail.collage = null;
            } else {
              this.campDetail.collage = null;
            }
          } else {
            this.campDetail.collage = null;
          }
          if (res.sales != null && res.sales.status && (res.sales.limit == 0 || res.sales.balance > 0) && this.companyAuth.enableFlashSalesModule == 1 && (this.campDetail.termStatus != 3 && this.campDetail.termStatus != 4 && this.campDetail.termStatus != 5 && this.hasExpired == false || this.campDetail.joinMode == 2)) {
            let nt = (new Date()).getTime();
            let st = utilJs.getTimeByDate(res.sales.sales.startTime);
            let et = utilJs.getTimeByDate(res.sales.sales.endTime);
            if (nt >= st && nt < et && this.campDetail.sales.sales.status > -1) {
              this.isSales = true;
              this.campDetail.sales.sales.status = 2;
            } else if (nt < st && this.campDetail.sales.sales.status == 1) {
              this.isSales = false;
              this.campDetail.sales.sales.status = 1;
              // $this.campDetail.sales = null;
            } else if (nt >= et && this.campDetail.sales.sales.status == 2) {
              this.campDetail.sales.sales.status = -1;
              this.campDetail.sales = null;
            } else {
              this.campDetail.sales = null;
            }
          } else {
            this.campDetail.sales = null;
          }
          let giftPops = localStorage.getItem('giftPopArr') ? JSON.parse(localStorage.getItem('giftPopArr')) : [];
          if ($this.campDetail.hasPermission && $this.campDetail.giftRelates && $this.campDetail.giftRelates.length > 0 && !giftPops.includes($this.campId)) {
            $this.campDetail.giftRelates.forEach((item) => {
              if (item.prodType == global.ckFrom.shopping && item.status != 1) {
                // this.goodsToGet = true;
                $this.$cjConfirm({
                title: '', //
                titleCenter: true, //标题是否居中
                message: '赠品礼包中包含商城商品，是否前往兑换',
                messageCenter: true, //内容是否居中
                showMasker: true, //是否显示透明背景
                clickCloseModal: false, //是否点击透明背景关闭弹窗
                showCancelButton: true, //是否显示取消按钮
                cancelButtonText: '取消', //取消按钮文本
                confirmButtonText: '去兑换', //确认按钮文本
                onConfirm() {
                  let giftPopArrTmp = localStorage.getItem('giftPopArr') ? JSON.parse(localStorage.getItem('giftPopArr')) : [];
                  giftPopArrTmp.push($this.campId)
                  localStorage.setItem('giftPopArr', JSON.stringify(giftPopArrTmp));
                  $this.popGiftModal();
                },
                onCancel() {
                  let giftPopArrTmp = localStorage.getItem('giftPopArr') ? JSON.parse(localStorage.getItem('giftPopArr')) : [];
                  giftPopArrTmp.push($this.campId)
                  localStorage.setItem('giftPopArr', JSON.stringify(giftPopArrTmp));
                }
              })
              }
            })
          }
          $this.getCommentStatus();
          if (res.isEnroll) {
            $this.watchRecord();
          }
          $this.wechatShare();
        }
        if (res.sales && res.sales.sales) {
          $this.isSalesBegin = (res.sales.sales.startTime).replace(/\s+|[-]|[:]/g, "") <= (utilJs.getNowTime()).replace(/\s+|[-]|[:]/g, "") ? true : false;
        }
        $this.campDetail.showMarketingCard = $this.campDetail.isFriendHelper || $this.campDetail.bargain || $this.isSales || ($this.campDetail.collage && ($this.campDetail.collage.status == 2 || $this.campDetail.collage.status == 1))
        if (fromOtherPage == 1) {
          $this.getCata();
        }
        if ($this.campDetail.joinMode == 1 && !this.campDetail.hasPermission) {
          $this.$store.commit("updateHasNoticeText", true);
        }
        $this.$nextTick(() => {
          $this.$refs.descriptions.getDescptionDetail();
        })
      },
        failRes => {
          isLoading = false;
        });
    },
    //获取缓存中进度
    getProgress(key) {
      if (localStorage.getItem(`camp${key}`) == 100) {
        return true;
      } else {
        return false;
      }
    },
    scrollToLearn() {
      this.$nextTick(() => {
        let offsetTop = document.getElementById('scrollToLearn') && document.getElementById('scrollToLearn').offsetTop;
        if (offsetTop) {
          document.documentElement.scrollTop = offsetTop;
          document.body.scrollTop = offsetTop;
        }
      })
    },
    //获取目录
    getCata: function () {
      if (isLoading) {
        return;
      }
      isLoading = true;
      let limit10 = 10;
      // 判断当前学习记录
      if (this.campDetail.hasPermission && this.campDetail.learningPosition && JSON.stringify(this.campDetail.learningPosition) != '[]') {
        if (this.listPage == 1) {
          limit10 = this.campDetail.learningPosition.page * 10;
        } else {
          limit10 = 10;
        }
      }
      let postUrl = `${global.apiurl}k12/trainings/${this.campId}/dirs?page=${this.listPage}&limit=${limit10}`;
      utilJs.getMethod(postUrl, res => {
        isLoading = false;
        if (res.data && res.data.length > 0) {
          res.data.forEach((item) => {
            item.date = utilJs.dateFormatNew(item.date, "MM月DD日");
            item.lessons.forEach((item) => {
              if (this.getProgress(item.id)) {
                if (item.notReachedButton == true) {
                  item.ratio = 0;
                }
                localStorage.removeItem(`camp${item.id}`)
              }
            })
          });
        }
        if (this.listPage == 1) {
          this.catalog = res.data;
          // this.courseCount = res.total;
          // this.getPackageDetail();
        } else {
          this.catalog = this.catalog.concat(res.data);
        }
        this.listPage = res.data && (res.data.length >= limit10) ? (this.listPage + 1) : this.listPage;
        this.listIsPage = res.data && (res.data.length >= limit10) ? true : false;
        if (this.campDetail.hasPermission && this.listIsPage && this.listPage == 2 && this.campDetail.learningPosition && JSON.stringify(this.campDetail.learningPosition) != '[]') {
          this.listPage = this.campDetail.learningPosition.page + 1;
          this.$nextTick(function () {
            this.scrollToLearn();
          });
        } else if (this.campDetail.hasPermission && !this.listIsPage && this.listPage == 1 && this.campDetail.learningPosition && JSON.stringify(this.campDetail.learningPosition) != '[]') {
          this.$nextTick(function () {
            this.scrollToLearn();
          });
        }
        // this.catalog = res;
      },
        failRes => {
          isLoading = false;
        });
    },
    getCommentStatus () {
      this.commentStatus = 0;
      const campEnableComment = this.campDetail.enableComment == 1 && (this.campDetail.enableCommentTag == 1 || this.campDetail.enableCommentBottom == 1)
      const cfgEnableCommen = this.campDetail.enableComment == 2 && this.cfg && this.cfg.enableComment == 1 && this.cfg.enableTrainingComment == 1
      if (campEnableComment || cfgEnableCommen) {
        this.commentStatus = 1;
        this.$nextTick(() => {
          this.$refs.commentCom && this.$refs.commentCom.public_initData()
          this.$refs.detailCommentCom && this.$refs.detailCommentCom.public_initData()
        })
      }
    },
    // 相关推荐
    relevance() {
      utilJs.postMethod(global.apiurl + 'common/relevance', { objId: this.campId, ckFrom: this.ckfrom.camp }, res => {
        this.relationData = res;
      });
    },
    goForm(isPresent = 0) {
      if (this.campDetail.isRelForm && (!this.campDetail.hasFormLog || (this.campDetail.hasFormLog && this.campDetail.enableEdit == 2)) && localStorage.getItem("showForm") == 1) {
        let pId = this.isSales ? this.campDetail.sales.pId : null;
        let joinType = this.campDetail.hasPermission && !this.campDetail.isEnroll ? 1 : this.campDetail.payType;
        let isGoBack = this.campDetail.hasPermission == true || this.campDetail.payType == 3 || (this.isMarketing && !this.campDetail.sales) || this.campDetail.isSaleOnly == 0 ? 1 : 0;
        let goPath = `/homePage/form?relId=${this.campId}&ttId=${this.campId}&relType=6&type=1&ckFrom=${isPresent == 1 ? global.ckFrom.presentCamp : this.isSales ? global.ckFrom.flashSalesCamp : this.ckFrom}&joinType=${joinType}&cId=-1&extId=${this.campId}&pId=${pId}&isGoBack=${isGoBack}`;
        goPath = this.goodsRoomId ? `${goPath}&goodsRoomId=${this.goodsRoomId}` : goPath;
        this.$routerGo(this, "push", {
          path: goPath
        });
      }
    },
    //点击立即报名
    enroll: function () {

      // 添加缓存showGuideCampId
      // 有入群引导信息&&开启入群引导&&详情页底部弹窗引导 去购买前先缓存当前训练营id，等购买回来，有权限后自动弹出一次
      // if (this.campDetail && this.campDetail.guideData && this.campDetail.guideData.isOpenGuide == 1 && this.campDetail.guideData.guideType.includes(3) && !this.campDetail.hasPermission) {
      //   localStorage.setItem(`showGuideCampId`, this.campId)
      // }

      // if (!utilJs.isOpenIosGzhPay('Training')) {
      //   this.$store.commit('updateShowVitualModal', true);
      //   return;
      // }
      if ((this.bindPhoneSetting && this.bindPhoneSetting.getBind && this.campDetail.payType == 1) || (this.bindPhoneSetting && this.bindPhoneSetting.passwordBind && this.campDetail.payType == 3) || (this.bindPhoneSetting && this.bindPhoneSetting.buyBind && this.campDetail.payType != 3 && this.campDetail.payType != 1)) {
        let pathQuery = {};
        if (this.goodsRoomId) {
          pathQuery.goodsRoomId = this.goodsRoomId;
        }
        if (utilJs.goBindMobile(pathQuery)) return;
      }
      // 判断非推荐有礼下单支付得时候，如果当前是推荐有礼的不带参数，走普通下单流程
      if (this.recType != 3 && this.campDetail.recommend != null && this.campDetail.recommend.isExist == 0) {
        this.recRelateId = '';
      }
      if (!this.campDetail.isTeacher && (this.campDetail.collectPage == 1 || this.campDetail.payType == 1 || this.campDetail.payType == 3) && this.campDetail.collectPage != 3 && this.campDetail.isRelForm && !this.campDetail.hasFormLog && localStorage.getItem("showForm") == 1) {
        let pId = this.isSales ? this.campDetail.sales.pId : null;
        let joinType = this.campDetail.hasPermission && !this.campDetail.isEnroll ? 1 : this.campDetail.payType;
        let isGoBack = this.campDetail.hasPermission ? 1 : 0;
        let goPath = `/homePage/form?relId=${this.campId}&ttId=${this.campId}&relType=6&type=1&ckFrom=${this.isSales ? global.ckFrom.flashSalesCamp : this.ckFrom}&joinType=${joinType}&cId=-1&extId=${this.campId}&pId=${pId}&isGoBack=${isGoBack}&recRelateId=${this.recRelateId}&recType=${this.recType}`;
        goPath = this.goodsRoomId ? `${goPath}&goodsRoomId=${this.goodsRoomId}` : goPath;
        this.$routerGo(this, "push", {
          path: goPath
        });
      } else {
        if (this.campDetail.payType == 3) {
          this.showPassword = "true";
        } else if ((!this.campDetail.isEnroll && this.campDetail.hasPermission) || this.campDetail.payType == 1) { //未报名有权限 || 免费参与，调报名接口
          this.submitForm();
        } else { //未报名无权限的普通支付与奖金参与直接进入支付页
          // 直接报名ckForm不做转化 9078==有参加活动，还原成78==普通的训练营
          this.ckFrom = global.ckFrom.camp;
          this.checkEnrollSubmit();
        }
      }
    },
    // 提交报名
    submitForm: function (pwd = '') {
      if (isLoading) {
        return;
      }
      isLoading = true;
      let data = {
        password: this.campDetail.payType == 3 ? pwd : '',
      };
      utilJs.postMethod(`${global.apiurl}k12/trainings/${this.campId}/startEnroll`, data, res => {
        isLoading = false;
        this.showPassword = false;
        if (this.campDetail.payType == 1 || this.campDetail.payType == 3 || (this.campDetail.hasPermission && !this.campDetail.isEnroll)) {
          this.getCampDetail(2);
          this.$showCjToast({
            text: "报名成功！",
            type: "success",
          });
        }
      },
        failRes => {
          isLoading = false;
        });
    },
    // 兼容限制人数得接口调用
    checkEnrollSubmit() {
      utilJs.postMethod(`${global.apiurl}k12/trainings/${this.campId}/checkEnroll`, {}, res => {
        this.isCheckEnroll = true;
        if (this.isCheckEnroll) {
          // 有入群引导信息&&开启入群引导&&详情页底部弹窗引导 去购买前先缓存当前训练营id，等购买回来，有权限后自动弹出一次
          // if (this.campDetail && this.campDetail.guideData && this.campDetail.guideData.isOpenGuide == 1 && this.campDetail.guideData.guideType.includes(3) && !this.campDetail.hasPermission) {
          //   localStorage.setItem(`showGuideCampId`, this.campId)
          // }
          let pId = this.isSales && this.optimal && this.optimal.optimalPriceType == 101 ? this.campDetail.sales.pId : null;
          let ckFrom = this.isSales ? global.ckFrom.flashSalesCamp : this.ckFrom;
          // 在有最低价格且营销活动的情况下，直接从训练营跳转到支付页面的ckFrom设置为ckfrom.camp
          if (this.optimal && ((this.campDetail.sales && this.optimal.optimalPriceType != 101) || (this.campDetail.bargain && ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1)
          || this.campDetail.bargain.status == 2)) || (this.campDetail.collage && (this.campDetail.collage.status == 2 || this.campDetail.collage.status == 1)) || (this.campDetail.isFriendHelper))) {
            ckFrom = this.ckfrom.camp
          }
          let goPath = `/homePage/course/coursePay?cId=-1&extId=${this.campId}&ckFrom=${ckFrom}&isFromInvite=0&joinType=${this.campDetail.payType}&pId=${pId}&recRelateId=${this.recRelateId}&recType=${this.recType}`;
          goPath = this.goodsRoomId ? `${goPath}&goodsRoomId=${this.goodsRoomId}` : goPath;
          this.$routerGo(this, "push", { path: goPath });
        }
      },
      failRes => {
        this.isCheckEnroll = false;
      });
    },
    //输入密码进入
    clickPassword() {
      this.showPassword = true;
    },
    // 报名时间
    timeFn: function () {
      let stime = utilJs.getTimeByDate(this.campDetail.enrollStartAt);
      let etime = utilJs.getTimeByDate(this.campDetail.enrollEndAt);
      let nowTime = (new Date()).getTime();
      //enrollStatus 1未开始,2进行中,3已结束
      let time = '';
      if (stime > nowTime) {
        this.enrollStatus = 1;
        time = stime;
      } else if (etime > nowTime) {
        this.enrollStatus = 2;
        time = etime;
      } else {
        this.enrollStatus = 3;
      }
      return time;
    },
    finishFn: function () {
      if (this.enrollStatus == 1) {
        this.enrollStatus = 2;
      } else {
        this.enrollStatus = 3;
      }
    },
    moreDeviceScroll() {
      let bWidth = document.getElementById('app').clientWidth;
      let moreDeviceHeight = (bWidth / 16) * 2;
      let scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      let deviceOffsetTop =
      document.querySelector("#moreDevice").offsetTop != null
          ? document.querySelector("#moreDevice").offsetTop
          : 0;
      // let infoOffsetTop =
      // document.querySelector("#courseInfo").offsetTop != null
      //     ? document.querySelector("#courseInfo").offsetTop
      //     : 0;
      if (deviceOffsetTop > 0) {
        if (scrollTop >= (deviceOffsetTop + moreDeviceHeight)) {
          this.moreDeviceType = 2;
        } else {
          this.moreDeviceType = 1;
        }
      }
    },
    handleScroll: function () {
      var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      var offsetTop = document.querySelector('#divider').offsetTop != null ? document.querySelector('#divider').offsetTop : 68;
      if (scrollTop >= offsetTop) {
        this.tabhBarFixed = true;
      } else {
        this.tabhBarFixed = false;
      }
      //滚到底部加载更多，延迟200ms防止刚切换tab的时候就触发
      let that = this;
      setTimeout(() => {
        let sTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
        let clientHeight = document.body.clientHeight && document.documentElement.clientHeight ? Math.min(document.body.clientHeight, document.documentElement.clientHeight) : Math.max(document.body.clientHeight, document.documentElement.clientHeight);
        let scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
        if (sTop + clientHeight >= (scrollHeight - 20) && that.typeBar == 1 && that.listIsPage) {
          that.getCata();
        }
      }, 200);
      // if (document.querySelector("#moreDevice")) {
      //   this.moreDeviceScroll();
      // }
    },
    // 判断权限提示
    permissionWarn: function() {
      let isNext = true;
      if (this.campDetail.termStatus != 2 && this.campDetail.termStatus != 6 && this.hasExpired == false && this.campDetail.joinMode == 1) {
          if (this.campDetail.termStatus == 1) {
            this.$showCjToast({
              text: '报名未开始',
              type: 'warn'
            });

            isNext = false;
          } else {
            this.$showCjToast({
              text: '报名已截止',
              type: 'warn'
            });
            isNext = false;
          }
      } else if (this.hasExpired && this.campDetail.joinMode == 1) {
        this.$showCjToast({
          text: '营期已结束',
          type: 'warn'
        });
        isNext = false;
      } else {
        if (this.campDetail.payType == 1) {
          this.$showCjToast({
            text: '请报名后开始学习',
            type: 'warn'
          });
          isNext = false;
        } else if (this.campDetail.payType == 3) {
          this.$showCjToast({
            text: '输入密码后开始学习',
            type: 'warn'
          });
          isNext = false;
        } else {
          this.$showCjToast({
            text: `请${this.campDetail.hasPermission ? '报名' : '购买'}后开始学习`,
            type: 'warn'
          });
          isNext = false;
        }
      }
      return isNext
    },
    // 跳转详情页
    clickLessonDetail: function (lessonInfo, isLock, tpId, lessIndex, index) {
      if (this.isUserGroup) {
        this.$showCjToast({
          text: `仅指定用户可参与`,
          type: 'warn'
        });
        return;
      }
      if ((!this.campDetail.hasPermission || (this.campDetail.hasPermission && !this.campDetail.isEnroll)) && lessonInfo.isFree == 0 && !this.campDetail.isTeacher) {
        if (!this.permissionWarn()) {
          return
        }
      } else {
        if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
          if (utilJs.goBindMobile()) return;
        }
        if (this.hasExpired && this.campDetail.joinMode == 1) {
          this.$showCjToast({
            text: '营期已结束',
            type: 'warn'
          });
          return;
        }
        // 当为日期模式+自定义时间的时候判断更改当前isLock
        if (this.campDetail.modeType == 1 && this.campDetail.dateLockType == 2) {
          isLock = lessonInfo.isLock;
        }
        // 当为闯关模式的时候判断更改当前isLock
        if (this.campDetail.modeType == 3) {
          isLock = lessonInfo.isLock;
        }
        // 当为定期模式的时候判断更改当前isLock
        if (this.campDetail.modeType == 4) {
          isLock = lessonInfo.isLock;
        }
        if (this.campDetail.isTeacher) {
          if (this.campDetail.modeType == 1) {
            isLock = lessonInfo.isLock;
          } else {
            isLock = false
          }

        }
        if (isLock && lessonInfo.isFree == 0 || isLock && lessonInfo.isFree == 1 && this.campDetail.hasPermission) {
          this.$showCjToast({
            text: '内容未解锁',
            type: 'warn'
          });
        } else {
          // let $this = this;
          this.setCampProgress(lessIndex, index)
          if (this.campDetail.hasPermission && this.campDetail.collectPage != 3 && this.campDetail.isRelForm && !this.campDetail.hasFormLog && localStorage.getItem("showForm") == 1) {
            this.goForm()
            return;
          }
          // 履约小程序套壳并且是直播跳转到直播小程序
          if (utilJs.getFromApplicationNum() == 5 && lessonInfo.relType == 51) {
            //公开课链接
            const ENV = process.env.VUE_APP_ENV;
            const ENV_MAP = {
              'dev':1,
              'sit':2,
              'production':3
            }
            this.wxappQuery = `env=${ENV_MAP[ENV]}&liveId=${lessonInfo.relId}&socialRoomId=${lessonInfo.jGRoomId}&from=lvApp&token=${localStorage.getItem("token")}}`;
            this.wxappPath = 'rooms/pages/vertical/index';
            return
          }
          switch (lessonInfo.relType) {
            // 5课程，8资料，51直播，41打卡，11考试，76表单，77AI测评, 780为新版跳转到视音频课程链接
            case 202:
              this.$routerGo(this, "push", {
                path: `/homePage/schoolAssignment/assignDetail?homeworkType=${lessonInfo.homeworkType}&thwId=${lessonInfo.relId}&tlId=${lessonInfo.id}&relType=${lessonInfo.relType}&ttId=${this.campId}&tpId=${tpId}&ckFrom=${this.ckFrom}`
              });
              break
            case 780:
              this.$routerGo(this, "push", {
                path: `/homePage/camp/campCourse?lessonId=${lessonInfo.id}&themeId=${this.themeId}&relType=${lessonInfo.relType}&campId=${this.campId}&tpId=${tpId}&parentType=${lessonInfo.parentType}&ckFrom=${this.ckFrom}&progress=${lessonInfo.ratio}`
              });
              break
            case 5:
              if (lessonInfo.isCourse == 1) {
                this.$routerGo(this, "push", {
                  path: `/homePage/course/${lessonInfo.parentType == 0 ? 'video' : lessonInfo.parentType == 1 ? 'voice' : 'imgText'}?courseId=${lessonInfo.relId}&ckFrom=${this.ckFrom}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&themeId=${this.themeId}`
                })
              } else {
                this.$routerGo(this, "push", {
                  path: `/homePage/camp/campCourse?lessonId=${lessonInfo.id}&campId=${this.campId}&tpId=${tpId}&parentType=${lessonInfo.parentType}&ckFrom=${this.ckFrom}&progress=${lessonInfo.ratio}&themeId=${this.themeId}`
                });
              }
              break;
            case 8:
              this.$routerGo(this, "push", {
                path: `/homePage/datum/datumDetail?ttId=${this.campId}&tpId=${tpId}&datumId=${lessonInfo.relId}&ckFrom=${this.ckFrom}&tlId=${lessonInfo.id}&themeId=${this.themeId}`
              });
              break;
            case 51:
              this.$routerGo(this, "push", {
                path: `/homePage/live/liveDetail?liveId=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              });
              break;
            case 41:
              switch (lessonInfo.parentType) {
                case 1:
                  //日历打卡,若当前日期不在开始日期和结束日期之间，则从开始日期进入，否则从当前日期进入
                  let startTimeTamp = new Date(`${lessonInfo.startTime} ${lessonInfo.startHour}`.replace(/-/g, "/")).getTime();
                  let endTimeTamp = new Date(`${lessonInfo.endTime} ${lessonInfo.endHour}`.replace(/-/g, "/")).getTime();
                  let nowTimeTamp = new Date().getTime();
                  let curTime = lessonInfo.startDay; //utilJs.dateFormat(nowTimeTamp);
                  if (nowTimeTamp < startTimeTamp || nowTimeTamp > endTimeTamp) {
                    curTime = lessonInfo.startTime;
                  }
                  // 区分跳转打卡结果页还是任务页面--/进度100%跳转结果页
                 if (lessonInfo.ratio == 100) {
                    this.goToTypeClockIn(lessonInfo.parentType, lessonInfo, isLock, tpId, lessIndex, index)
                  } else {
                    this.$routerGo(this, "push", {
                      path: `/homePage/clockIn/stuHomeWorkDiary?workType=1&clockInId=${lessonInfo.parentId}&curDate=${curTime}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
                    });
                  }
                  break;
                case 2:
                    // 区分跳转打卡结果页还是任务页面--/进度100%跳转结果页
                    if (lessonInfo.ratio == 100) {
                      this.goToTypeClockIn(lessonInfo.parentType, lessonInfo, isLock, tpId, lessIndex, index)
                    } else {
                      //作业打卡，如果超过一个作业，则进入作业列表，否则进入作业详情
                      this.$routerGo(this, "push", {
                        path: `/homePage/clockIn/stuHomeWorkDiary?workType=2&curId=${lessonInfo.hwId}&clockInId=${lessonInfo.parentId}&fromDetail=&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
                      });
                    }
                  break;
                case 3:
                  //闯关打卡
                  // 区分跳转打卡结果页还是任务页面--/进度100%跳转结果页
                 if (lessonInfo.ratio == 100) {
                    this.goToTypeClockIn(lessonInfo.parentType, lessonInfo, isLock, tpId, lessIndex, index)
                  } else {
                    this.$routerGo(this, "push", {
                      path: `/homePage/clockIn/stuHomeWorkDiary?workType=3&clockInId=${lessonInfo.parentId}&curId=${lessonInfo.hwId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&isTraining=1&themeId=${this.themeId}`
                    });
                  }
                  break;
              }
              break;
            // case 11:
              // if (lessonInfo.totalNum == 0) {
              //     this.$showCjToast({
              //       text: '该试卷无题目',
              //       type: 'warn'
              //     });
              //     return
              // }
              // utilJs.postMethod(global.apiurl + "paper/entryRecord", {
              //   paperMainId: lessonInfo.relId,
              //   prodId: this.campId,
              //   prodType: global.ckFrom.camp
              // }, res => {
              //   if (lessonInfo.examStatus == 0) {
              //     if (lessonInfo.parentType == 1) {
              //       utilJs.getMethod(global.apiurl + 'paper/judgeEntry/' + lessonInfo.relId, function (res) {
              //         if (res.status == 1) {
              //           utilJs.getMethod(`${global.apiurl}exam/transit/${lessonInfo.relId}?topicId=${lessonInfo.parentId}&entryProdType=3&prodId=${$this.campId}`, res => {
              //             $this.$routerGo($this, "push", {
              //               path: `/homePage/examination/examinationAnswer?paperMainId=${lessonInfo.relId}&topicId=${lessonInfo.parentId}&goOnNum=1&tlId=${lessonInfo.id}&ttId=${$this.campId}&tpId=${tpId}&ckFrom=${$this.ckFrom}&isRelevance=1&themeId=${$this.themeId}`
              //             });
              //           })
              //         } else {
              //           $this.$showCjToast({
              //             text: res.msg + '</br>' + res.showTime,
              //             type: 'warn'
              //           });
              //         }
              //       })
              //     }
              //   } else if (lessonInfo.examStatus == 1) {
              //     $this.$routerGo($this, "push", {
              //       path: `/homePage/examination/examinationResult?paperMainId=${lessonInfo.relId}&topicId=${lessonInfo.parentId}&tlId=${lessonInfo.id}&ttId=${$this.campId}&tpId=${tpId}&ckFrom=${$this.ckFrom}&isRelevance=1&themeId=${$this.themeId}`
              //     });
              //   } else if (lessonInfo.examStatus == 2) {
              //     utilJs.getMethod(global.apiurl + 'paper/judgeEntry/' + lessonInfo.relId, function (res) {
              //       if (res.status == 1) {
              //         $this.$routerGo($this, "push", {
              //           path: `/homePage/examination/examinationAnswer?paperMainId=${lessonInfo.relId}&topicId=${lessonInfo.parentId}&goOnNum=${lessonInfo.goOnNum}&tlId=${lessonInfo.id}&ttId=${$this.campId}&tpId=${tpId}&ckFrom=${$this.ckFrom}&isRelevance=1&themeId=${$this.themeId}`
              //         });
              //       } else {
              //         $this.$showCjToast({
              //           text: res.msg + '</br>' + res.showTime,
              //           type: 'warn'
              //         });
              //       }
              //     })
              //   }
              // })
              // break;
            case 76:
              this.$routerGo(this, "push", {
                path: `/homePage/form?relId=${lessonInfo.relId}&relType=6&type=2&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&joinType=${this.campDetail.payType}&themeId=${this.themeId}`
              });
              break;
            case 77:
              this.$routerGo(this, "push", {
                path: `/homePage/voiceTest/voiceTestDetail?paperMainId=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&progress=${lessonInfo.ratio}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              })
              break;
            case 75:
              this.$routerGo(this, "push", {
                path: `/homePage/mutuaTest/mutuaTestDetail?mutuaTestId=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&progress=${lessonInfo.ratio}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              })
              break;
            case 129:
              this.$routerGo(this, "push", {
                path: `/homePage/itemBank/questionSaleDetail?libraryId=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&progress=${lessonInfo.ratio}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              })
              break;
            case 125:case 11:
              this.$routerGo(this, "push", {
                path: `/homePage/testPaper/testDetail?testId=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&progress=${lessonInfo.ratio}&ckFrom=${this.ckFrom}&origin=${global.ckFrom.camp}&prodId=${this.campId}&themeId=${this.themeId}`
              })
              break;
            case 142:
              this.$routerGo(this, "push", {
                path: `/homePage/ebooks/ebooksDetail?id=${lessonInfo.relId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&progress=${lessonInfo.ratio}&themeId=${this.themeId}`
              })
          }
        }
      }
    },
    // 跳转打卡不同的
    goToTypeClockIn(workType, lessonInfo, isLock, tpId, lessIndex, index) {
      // 先请求详情接口数据，在分类判断跳转那个接口
      let postUrl = global.apiurl + `signCard/examInfoFromHwId/${lessonInfo.hwId}`
      utilJs.getMethod(postUrl,
        (res) => {
          if (!res.data) {
            // 如果记录被删除，跳转原来的流程
            if (workType == 1) {
              let nowTimeTamp = new Date().getTime();
              let curTime = utilJs.dateFormat(nowTimeTamp);
              this.$routerGo(this, "push", {
                path: `/homePage/clockIn/stuHomeWorkDiary?workType=1&clockInId=${lessonInfo.parentId}&curDate=${curTime}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              });
            } else if (workType == 2) {
              //作业打卡，如果超过一个作业，则进入作业列表，否则进入作业详情
              this.$routerGo(this, "push", {
                path: `/homePage/clockIn/stuHomeWorkDiary?workType=2&curId=${lessonInfo.hwId}&clockInId=${lessonInfo.parentId}&fromDetail=&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&themeId=${this.themeId}`
              });
            } else {
              this.$routerGo(this, "push", {
                path: `/homePage/clockIn/stuHomeWorkDiary?workType=3&clockInId=${lessonInfo.parentId}&curId=${lessonInfo.hwId}&ttId=${this.campId}&tpId=${tpId}&tlId=${lessonInfo.id}&ckFrom=${this.ckFrom}&isTraining=1&themeId=${this.themeId}`
              });
            }
          } else {
            // 有返回数据跳转到对应结果页面
            const {examMainId, hwId, signColId, type, startDay} = res.data
            if (type == 1 || type == 4) {
              // 简答题1 表单4
              this.$routerGo(this, "push", {
                path: "/homePage/clockIn/shortAnswerResult",
                query: {
                  clockInId: signColId,
                  curHwId : hwId,
                  curSelectDate: startDay,
                  ttId: this.campId,
                  tpId: tpId,
                  tlId: lessonInfo.id,
                  ckFrom: this.ckFrom,
                  isTraining: 1,
                  workType: workType,
                  examMainId: examMainId,
                }
              });
            } else if (type == 3) {
              // ai语音结果页 type = 3
              this.$routerGo(this, "push", {
                path: "/homePage/clockIn/voiceResult",
                query: {
                  ttId: this.campId,
                  tpId: tpId,
                  tlId: lessonInfo.id,
                  curHwId: hwId,
                  totalNum: lessonInfo.hasQuestions,
                  examMainId: examMainId,
                  clockInId: signColId,
                  workType: workType,
                  curSelectDate: startDay,
                }
              });
            } else {
              // 非简答题2
              this.$routerGo(this, "push", {
                path: "/homePage/clockIn/homeWorkResult",
                query: {
                  ttId: this.campId,
                  tpId: tpId,
                  tlId: lessonInfo.id,
                  examMainId: examMainId,
                  isFromDetail: true,
                  workType: workType,
                  clockInId: signColId,
                  curHwId : hwId,
                  curSelectDate: startDay,
                }
              });
            }
          }
        })
    },
    // 获取毕业证书
    getCertificate: function () {
      utilJs.postMethod(`${global.apiurl}k12/trainings/${this.campId}/card/receive`, {}, res => {
        this.beginShowCertificate();
      });
    },
    // 证书展示
    beginShowCertificate: function () {
      let postUrl = `${global.apiurl}Certificate/cardShow?prodType=${global.ckFrom.camp}&prodId=${this.campId}`
      utilJs.getMethod(postUrl, res => {
        this.showCertificate = true;
        this.showRepPop = false;
        this.campName = res.name;
        let title = res.prodName;
        let titleT = '【' + res.prodName + '】';
        let titleArr = [];
        if (titleT.length > 0 && titleT.length <= 18) {
          let title1 = titleT.substring(0, 18);
          titleArr.push(title1);
        } else if (titleT.length > 18) {
          let title1 = titleT.substring(0, 18);
          let title2 = "";
          if (titleT.length <= 36) {
            title2 = titleT.substring(18, 36);
          } else {
            title2 = titleT.substring(18, 34);
            title2 = title2 + "...】";
          }
          titleArr.push(title1);
          titleArr.push(title2);
        }

        let qrcodeUrl = "";
        let qrText = "";
        // "redirectTo" 跳转，1：详情页，2：首页
        let redirectQr = "";
        if (res.redirectTo == 1) {
          redirectQr = res.trainingBaseInfo.qrCodeUrl;
          qrText = "进入训练营";
        } else if (res.redirectTo == 2) {
          redirectQr = res.trainingBaseInfo.homeQrcode;
          qrText = "进入首页"
        } else {
          redirectQr = res.customizeQrCode.img;
        }
        qrText = res.qrCodeText ? res.qrCodeText : qrText
        if (redirectQr.includes("?")) {
          qrcodeUrl = redirectQr + "&time=" + new Date().getTime();
        } else {
          qrcodeUrl = redirectQr + "?time=" + new Date().getTime();
        }
        let imgurl2 = 'https://kposshzcdn.ckjr001.com/2087/resource/admin-fe_jzr8_TcMTRdPGYzjj3QQA6kNw.png'
        if (res.image == imgurl2) {
          res.backdropId = 3
        }
        this.certificateInfo = {
          bgImgUrl: res.image,
          headimgurl: res.headimgurl || require('@/assets/defult_head.png'),
          nameTypeShow: res.nameTypeShow,
          nickname: res.nickname,
          realName: res.realName,
          name: res.prodName,
          nameText: title, //去掉符号的营期名
          qrcodeUrl: qrcodeUrl,
          qrText: qrText,
          backdropId: res.backdropId,
          contentType: res.contentType,
          word: res.content || [],
          certificateType: res.certificateType,
          defineShowContent:res.defineShowContent,
          enableAvatarShow:res.enableAvatarShow,
          finishCourseNum: res.trainingBaseInfo.finishCourseNum,
          finishExamNum: res.trainingBaseInfo.finishExamNum,
          finishExamTotalScore: res.trainingBaseInfo.finishExamTotalScore,
          finishSignNum: res.trainingBaseInfo.finishSignNum,
          finishTaskNum: res.trainingBaseInfo.finishTaskNum,
          customizeControl:res.customizeControl,
          customizeImage:res.customizeImage,
          createdAt:res.createdAt,
          shareDesc:res.shareDesc,
          enableShowQrCode:res.enableShowQrCode,
          title:res.title,
          enableInstitution:res.enableInstitution, //是否展示发证机构：1=展示；0=隐藏
          institutionName:res.institutionName, //机构名称
          enableGrantTime:res.enableGrantTime, //是否展示发证时间  1=展示；0=隐藏
          enableNumber:res.enableNumber, //是否展示证书编号 1=展示；0=隐藏
          number:res.number, //起始编号
          enableStamp:res.enableStamp, //是否展示章戳  1=展示；2=自定义; 0=隐藏
          stampImg:res.stampImg, //章戳自定义图片
          shapeType:res.shapeType,
        };
        this.wechatShare();
      },
        failRes => {
        });
    },
    //作为分享页被推荐人进入
    isRecommendPage() {
      let recRelateId = this.recRelateId; //推荐人ID
      let recType = this.recType; //推荐类型 1 访问 2 绑定 3 支付
      let bindPhone = this.$route.query.bindPhone; //完成推荐绑定手机号
      let data = {relateId: recRelateId};
      if (recRelateId) {
        if (recType == 1) {
          this.$nextTick(() => {
            this.$refs.recommendPresent.completetRecommendTask(data); // 调用子组件方法
          })
        } else if (recType == 2) {
          if (bindPhone) {
            data.mobile = localStorage.getItem("uMobile");
            this.$nextTick(() => {
              this.$refs.recommendPresent.completetRecommendTask(data); // 调用子组件方法
            })
          } else if (!localStorage.getItem("uMobile")) {
            utilJs.goBindMobile({
                recRelateId: recRelateId,
                recType: recType,
                goVideo: 1,
                campId: this.campId,
                extId: this.extId,
                ckFrom: this.ckFrom
            });
          } else {
            this.$cjConfirm({
              title: '领取失败',
              message: '您已绑定过手机号，不在推荐范围，无法领取奖励',
              showCancelButton: false,
            })
          }
        }
      }
    },
    //分享
    wechatShare: function () {
      let title = (this.campDetail.shareConf && this.campDetail.shareConf.shareTitle) || window.localStorage.getItem("shareTitle");
      let shareImg = this.campDetail.sales && this.campDetail.sales.shareImg ? this.campDetail.sales.shareImg : (this.campDetail.shareConf && this.campDetail.shareConf.sharePic || window.localStorage.getItem("shareLogo"));
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?campId=${this.campId}&ckFrom=${this.ckFrom}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = (this.campDetail.shareConf && this.campDetail.shareConf.shareDesc) || window.localStorage.getItem("shareDesc");
      if (this.campDetail.sales) {
        title = '【限时抢购】' + title;
      }
      if (this.companyAuth.enableFriendHelper == 1 && this.campDetail.isFriendHelper) {
        title = '【快来帮我灌溉吧】' + title;
      }
      if (this.campDetail.bargain != null && ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1) || this.campDetail.bargain.status == 2)) {
        title = `【邀您一起砍价】${title}`;
      }
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc, function () {
      });
    },
    //手机端分享
    appShare: function () {
      let title = (this.campDetail.shareConf && this.campDetail.shareConf.shareTitle) || window.localStorage.getItem("shareTitle");
      let shareImg = this.campDetail.sales && this.campDetail.sales.shareImg ? this.campDetail.sales.shareImg : (this.campDetail.shareConf && this.campDetail.shareConf.sharePic || window.localStorage.getItem("shareLogo"));
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?campId=${this.campId}&ckFrom=${this.ckFrom}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = (this.campDetail.shareConf && this.campDetail.shareConf.shareDesc) || window.localStorage.getItem("shareDesc");
      if (this.campDetail.sales) {
        title = '【限时抢购】' + title;
      }
      if (this.companyAuth.enableFriendHelper == 1 && this.campDetail.isFriendHelper) {
        title = '【快来帮我灌溉吧】' + title;
      }
      if (this.campDetail.bargain != null && ((this.campDetail.bargain.status == 1 && this.campDetail.bargain.isPreheat == 1) || this.campDetail.bargain.status == 2)) {
        title = `【邀您一起砍价】${title}`;
      }
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    }
  },
  deactivated() {
    window.removeEventListener('scroll', this.handleScroll);
    this.$store.commit("updateHasNoticeText", false);
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.badge-bg {
  width: 100%;
  height: 2.9rem;
  background: url('../../../assets/i/wap/camp/badge-bg.png') no-repeat center center;
  background-size: contain;
}
.timeShow {
  font-size: 0.6rem;
  color: #fff;
  line-height: 1.5rem;
  width: 100%;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  bottom: 0;
  left: 0;
}
.pop-body {
  position: absolute;
  top: 6rem;
  height: 15.5rem;
  background-color: #fafafa;
  border-radius: 10px;
  left: 50%;
  margin-left: -6.25rem;
  text-align: center;
  overflow: hidden;
}
.pop-title-position {
  top: 4.5rem;
  left: 0;
  background: url("../../../assets/i/wap/camp/font-bg.png") no-repeat 50% 50%;
  background-size: 12.5rem;
}
.pop-body img {
  width: 6rem;
  height: auto;
  margin: 0 auto;
}
.pop-title-btn {
  font-size: 14px;
  color: #fff;
  width: 220px;
  height: 40px;
  line-height: 40px;
  background: #ef7f31;
  border-radius: 24px;
  position: absolute;
  bottom: 20px;
  left: 50%;
  margin-left: -110px;
}
.rep-body {
  background-color: #fff;
  border-radius: 10px;
  text-align: center;
  margin: 0 auto;
  position: relative;
}
.pop-rep-button {
  font-size: 14px;
  color: #fff;
  width: 220px;
  height: 40px;
  line-height: 40px;
  background: #ef7f31;
  border-radius: 24px;
  margin: 20px auto 0 auto;
}
.name-ora {
  color: #ef7f31;
}
.tabhBar {
  width: 100%;
  max-width: 16rem;
  position: sticky;
  position: -webkit-sticky;
  top: 1.7rem;
  left: 0;
  right: 0;
  margin: auto;
  background-color: #fff;
  z-index: 900;
}
.c-p-b-20 {
  bottom: -0.5rem;
}
.c-p-r10 {
  right: 0.25rem;
}
.camp-guide {
  background: url("../../../assets/i/wap/course/group_guidance_bg.png") no-repeat;
  background-size: 100% 100%;
}
.c-mr110 {
  margin-right: 2.75rem;
}
.c-hh410 {
  height: 10.25rem;
}
.cata-cover {
  background-color: white;
  filter: blur(8px);
}
.minh76 {
  min-height: 1.9rem;
}
.left-bg {
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  height: 0.75rem;
  background: linear-gradient(90deg,#333333, rgba(51,51,51,0.7) 100%);
  border-radius: 0.15rem 0px 0.5rem 0.15rem;
  color: #F5D199;
}
.c-hh400 {
  height: 10rem;
}
.coupon-item {
  position: relative;
  border: none;
  color: #333;
}
.coupon-item:after{
  border-radius: 0.25rem;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid #333;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 200%;
  height: 200%;
  -webkit-transform: scale(0.5);
  transform: scale(0.5);
  -webkit-transform-origin: left top;
  transform-origin: left top;
}
.dia-coupon-butt{
  background: url("../../../../public/i/wap/coupon/button.png") no-repeat 100%;
  background-size: 100% 100%;
  color: #852F00;
  left: 50%;
  margin-left: -3.375rem;
  top: 1.2rem;
}
.go-use-butt{
  background: url("../../../../public/i/wap/coupon/button.png") no-repeat 100%;
  background-size: 100% 100%;
  color: #852F00;
  margin-top: 0.3rem;
}
.prodType-triangle {
    width: 0;
    height: 0;
    border-width: 0.2rem 0.2rem 0 0.2rem;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
    bottom: 0;
    right: 0;
}
.cart-icon{
  background:rgba(255,255,255,0.92);
}
.closeBig >>> p > img,
.closeBig >>> section > img,
.closeBig >>> div > img,
.closeBig >>> img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.aCloseBig >>> p > a > img,
.aCloseBig >>> section > a > img,
.aCloseBig >>> div > a > img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.bg-lpink {background: rgba(246,65,99,0.10)}
.fc-pink {color: #F64163;}
.fc-3F73F8 {
  color: #3F73F8;
}
.cer-bg {
  background: #FFF5E0;
}
.c-bg-right {
  background-image: linear-gradient(180deg, #F4CC90 0%, #EDB96B 99%);
}
.c-bg-time {
  background-image: linear-gradient(270deg, #FEF2EB 0%, #FCE9F6 100%);
}
.pa-im {
  position: absolute !important;
}
</style>
